Re: [PATCH RESEND v4 3/8] console: support set baudrate for fixed baudrate drivers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 17.08.21 12:10, Antony Pavlov wrote:
> There are console drivers (linux, virtio, litex)
> that don't support baud rate setting and has
> no setbrg (set baudrate) callback, so
> console_set_baudrate() returns -ENOSYS.
> 
> At the other hand console_set_baudrate() SUCCESS
> return value is needed for the loadx/loady commands
> correct work.
> 
> See discussion here:
> 
>   http://lists.infradead.org/pipermail/barebox/2021-May/036237.html
> 
> Signed-off-by: Antony Pavlov <antonynpavlov@xxxxxxxxx>

Reviewed-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
Tested-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>

> ---
>  common/console.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/common/console.c b/common/console.c
> index ad1a6aaab2..c902239e31 100644
> --- a/common/console.c
> +++ b/common/console.c
> @@ -165,12 +165,12 @@ int console_set_baudrate(struct console_device *cdev, unsigned baudrate)
>  	int ret;
>  	unsigned char c;
>  
> -	if (!cdev->setbrg)
> -		return -ENOSYS;
> -
>  	if (cdev->baudrate == baudrate)
>  		return 0;
>  
> +	if (!cdev->setbrg)
> +		return -ENOSYS;
> +
>  	/*
>  	 * If the device is already active, change its baudrate.
>  	 * The baudrate of an inactive device will be set at activation time.
> @@ -336,11 +336,13 @@ int console_register(struct console_device *newcdev)
>  		ret = newcdev->setbrg(newcdev, baudrate);
>  		if (ret)
>  			return ret;
> -		newcdev->baudrate_param = newcdev->baudrate = baudrate;
> +		newcdev->baudrate_param = baudrate;
>  		dev_add_param_uint32(dev, "baudrate", console_baudrate_set,
>  			NULL, &newcdev->baudrate_param, "%u", newcdev);
>  	}
>  
> +	newcdev->baudrate = baudrate;
> +
>  	if (newcdev->putc && !newcdev->puts)
>  		newcdev->puts = __console_puts;
>  
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux