From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 04338ECAAA1 for ; Tue, 30 Aug 2022 09:35:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: MIME-Version:References:Message-ID:In-Reply-To:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zEuqO+haNeq3bSK5F1X8tpb888w4TWAjTJWIZVhBhqM=; b=tct/t3d2OwTeOp8mHg4SCF3ogH F/h+zH6h2xkUbeUfOtBvrhFwEhNLCWk4JjHVRv/maxxsjD9etdnX6eBIKRCEoKmAxHFKy7q24seHm Bbq0KTtGCjPURr7oPw0WFkNfFk0VZe6ZZxuwWL6kIhGEYhCIHbC8XEwB6cI8xm4Vdb6NlM4rAQx9D EkpqsrSbmSe/oUFzH22ZVI7HdRtcEBp+AkRCLwqMpxpsdqgkc8TLGBU4NXW4ebhQ/cMTXkYw+O7xQ BEgVAQpFA1XenfggoU+yZIf6iZyyH2y1+8I5t29RDFLl4xLEn2bKdLf3bIJrdGOtD8cTvNld1bquq n7pFlUGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oSxdc-00Fh8i-LD; Tue, 30 Aug 2022 09:34:28 +0000 Received: from mga04.intel.com ([192.55.52.120]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oSxdL-00Fgy2-Kc for linux-arm-kernel@lists.infradead.org; Tue, 30 Aug 2022 09:34:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661852051; x=1693388051; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=BZlFP+2gMdlipVyXYzNcamg3THGOdoHRiZzKamrAIYY=; b=bfh3LdHm4LU4bjSQMFpr9NnURHMqgTIgprsIuFKOvVk0EhlXoLzxWxkS dLon+jBo5zFENcOnjqR1YzNEqeOlqzCIAlDjxO6Cy4hzW2l5CgvDBXMzh DJ8s9lSVZC9UrRYv9S64hD5e0paK2l8lifM7wttWCv0o0fjtIU2ytCnsE G2FdJ9A/3OpCMiWXeShe+lShTeCrOHNHi1KJWG9yuCUDrfqq8v2e+T9D/ PvrUAKcGXD7oFQqhWTp2Kg8qP671RCaBjClrchiR0ZqOw2uxsHt1vo2kX edCX825cmJs72ftM6zi/Sqic8a+AdnkEiebwMDjxtI+I/3dIAIjPF9h8i g==; X-IronPort-AV: E=McAfee;i="6500,9779,10454"; a="293875063" X-IronPort-AV: E=Sophos;i="5.93,274,1654585200"; d="scan'208";a="293875063" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2022 02:34:07 -0700 X-IronPort-AV: E=Sophos;i="5.93,274,1654585200"; d="scan'208";a="588532455" Received: from arnesgom-mobl.ger.corp.intel.com ([10.252.54.235]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2022 02:34:01 -0700 Date: Tue, 30 Aug 2022 12:34:00 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Greg Kroah-Hartman Subject: Re: [PATCH v2 4/4] serial: Add kserial_rs485 to avoid wasted space due to .padding In-Reply-To: Message-ID: <31865b7-22f3-c07b-c934-83b44269eb3@linux.intel.com> References: <20220830072956.3630-1-ilpo.jarvinen@linux.intel.com> <20220830072956.3630-5-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-437881220-1661852048=:1864" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220830_023411_807506_3ED42511 X-CRM114-Status: GOOD ( 20.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , linux-doc@vger.kernel.org, Alexandre Torgue , LKML , Fabio Estevam , linux-stm32@st-md-mailman.stormreply.com, Jonathan Corbet , Jiri Slaby , Russell King , Lino Sanfilippo , NXP Linux Team , linux-serial , Pengutronix Kernel Team , Sascha Hauer , Vladimir Zapolskiy , Andy Shevchenko , linux-arm-kernel@lists.infradead.org, Richard Genoud , Maxime Coquelin , Shawn Guo , Claudiu Beznea Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-437881220-1661852048=:1864 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8BIT On Tue, 30 Aug 2022, Greg Kroah-Hartman wrote: > On Tue, Aug 30, 2022 at 10:29:56AM +0300, Ilpo Järvinen wrote: > > The struct serial_rs485 has a .padding field to make uapi updates > > easier. It wastes space, however. Create struct kserial_rs485 which is > > a kerner counterpart w/o padding. > > "kernel"? > > And what is the size difference now? Roughly 16B of padding is eliminated. That saving is then multiplied by the times it appears in in-kernel structs (2x per uart_port, 1x per rs485 supporting driver). As said in my other reply, if you feel it's too little gained by eliminating the padding, I can drop this patch, just let me know. > > +/** > > + * struct kserial_rs485 - kernel-side struct for controlling RS485 settings. > > + * @flags: RS485 feature flags > > + * @delay_rts_before_send: Delay before send (milliseconds) > > + * @delay_rts_after_send: Delay after send (milliseconds) > > + * @addr_recv: Receive filter for RS485 addressing mode > > + * (used only when %SER_RS485_ADDR_RECV is set). > > + * @addr_dest: Destination address for RS485 addressing mode > > + * (used only when %SER_RS485_ADDR_DEST is set). > > + * > > + * Must match with struct serial_rs485 in include/uapi/linux/serial.h excluding > > + * the padding. > > Why must this match? Because serial_rs485_from_user() and serial_rs485_to_user() just copy things over from one struct type to another w/o considering the fields individually. If that's not acceptable, I could make it copy field by field but it didn't feel necessary to allow "real" fields to differ to achieve padding elimination... > And how is that going to be enforced? With static_assert()s in serial_core.c. I'll add a note about that into the comment. > > + */ > > +struct kserial_rs485 { > > + __u32 flags; > > + __u32 delay_rts_before_send; > > + __u32 delay_rts_after_send; > > + struct { > > + __u8 addr_recv; > > + __u8 addr_dest; > > + }; > > As this is an in-kernel structure, this should be "u32" and "u8" now. Right, I'll change those. -- i. --8323329-437881220-1661852048=:1864 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --8323329-437881220-1661852048=:1864--