Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1485264 > unrolled thread

Re: [PATCH 2/4] serial: 8250: of: Load TX FIFO Load Size from DT

Started byRob Herring <robh@kernel.org>
First post2016-09-16 21:30 +0200
Last post2016-09-16 23:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 2/4] serial: 8250: of: Load TX FIFO Load Size from DT Rob Herring <robh@kernel.org> - 2016-09-16 21:30 +0200
    Re: [PATCH 2/4] serial: 8250: of: Load TX FIFO Load Size from DT Arnd Bergmann <arnd@arndb.de> - 2016-09-16 23:00 +0200

#1485264 — Re: [PATCH 2/4] serial: 8250: of: Load TX FIFO Load Size from DT

FromRob Herring <robh@kernel.org>
Date2016-09-16 21:30 +0200
SubjectRe: [PATCH 2/4] serial: 8250: of: Load TX FIFO Load Size from DT
Message-ID<si6ZH-ym-3@gated-at.bofh.it>
On Thu, Sep 08, 2016 at 11:12:19AM -0500, tthayer@opensource.altera.com wrote:
> From: Thor Thayer <tthayer@opensource.altera.com>
> 
> Initialize the tx_loadsz parameter if it is defined in the
> device tree.
> 
> Signed-off-by: Thor Thayer <tthayer@opensource.altera.com>
> ---
>  drivers/tty/serial/8250/8250_of.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c
> index 38963d7..3e4be2f 100644
> --- a/drivers/tty/serial/8250/8250_of.c
> +++ b/drivers/tty/serial/8250/8250_of.c
> @@ -195,6 +195,7 @@ static int of_platform_serial_probe(struct platform_device *ofdev)
>  	switch (port_type) {
>  	case PORT_8250 ... PORT_MAX_8250:
>  	{
> +		u32 prop;
>  		struct uart_8250_port port8250;
>  		memset(&port8250, 0, sizeof(port8250));
>  		port8250.port = port;
> @@ -202,6 +203,11 @@ static int of_platform_serial_probe(struct platform_device *ofdev)
>  		if (port.fifosize)
>  			port8250.capabilities = UART_CAP_FIFO;
>  
> +		/* Check for TX fifo load size */
> +		if (of_property_read_u32(ofdev->dev.of_node,
> +					 "tx-loadsz", &prop) == 0)
> +			port8250.tx_loadsz = prop;

This can be simplified to:

of_property_read_u32(ofdev->dev.of_node, "tx-loadsz", &port8250.tx_loadsz);


> +
>  		if (of_property_read_bool(ofdev->dev.of_node,
>  					  "auto-flow-control"))
>  			port8250.capabilities |= UART_CAP_AFE;
> -- 
> 1.7.9.5
> 

[toc] | [next] | [standalone]


#1485369

FromArnd Bergmann <arnd@arndb.de>
Date2016-09-16 23:00 +0200
Message-ID<si8oO-1p6-17@gated-at.bofh.it>
In reply to#1485264
On Friday, September 16, 2016 3:52:55 PM CEST Thor Thayer wrote:
> >
> >
> Yes, I originally had it implemented using that function but then I 
> realized the port8250.tx_loadsz is an unsigned int and therefore can 
> change size on different platforms.
> 
> The assignment handles that. In retrospect, I should probably change 
> this to a of_property_read_u8() anyway so that it won't cause compile 
> warnings in the smaller architectures.
> 
> Thank you for reviewing and the comments.

We don't support architectures with 'int' types other than 32 bits,
so the version that Rob suggested is guaranteed to work everywhere.

Using u8 properties seems like a bad idea in general, better stay
with 32-bit units for consistency.

	Arnd

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web