From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nikita Yushchenko Subject: Re: [V2, 2/6] tty: serial: lpuart: add little endian 32 bit register support Date: Wed, 17 May 2017 09:25:51 +0300 Message-ID: <55bae8d2-0e23-b5e1-f304-63d9130ccb08@cogentembedded.com> References: <1494834539-17523-3-git-send-email-aisheng.dong@nxp.com> <20170517033139.GB9913@b29396-OptiPlex-7040> <48819894-4943-7d14-ccf8-83cfd2195c9a@cogentembedded.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: "A.S. Dong" , Dong Aisheng Cc: "linux-serial@vger.kernel.org" , Andy Duan , "gregkh@linuxfoundation.org" , "Y.B. Lu" , "linux-kernel@vger.kernel.org" , "stefan@agner.ch" , Mingkai Hu , "jslaby@suse.com" , "linux-arm-kernel@lists.infradead.org" List-Id: linux-serial@vger.kernel.org >> Code should be consistent. >> > > Yes. > >> There is no good reason to have sport->lpuart32 inside sport, but >> lpuart_is_be outside of it. Both these values describe properties of >> particular device, and thus should be in per-device structure. >> > > That's for special case, normally we wouldn't do that. For me this "special case" looks like "let's break data structure consistency to reuse several lines of code". With code snippets you show, it looks even worse: you assign same global variable in several places for different uses. implicitly assuming that it is for same device. Which can be true in your current system, but not elsewhere (e.g. why not having lpuart programmed into fpga)? Alternative solution could be - have separate write path for earlycon. At a glance, it is dozen lines of code.