All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] serial: nulldev: Implement "pending" function to fix tstc return "true"
@ 2017-11-03  6:39 Wilson Lee
  2017-11-17 15:44 ` [U-Boot] " Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Wilson Lee @ 2017-11-03  6:39 UTC (permalink / raw)
  To: u-boot

In U-boot, serial_tstc was use to determine is there have a character in
serial console that pending for read. If there is no "pending" function
implemented in serial driver, the serial-uclass will return "true(1)"
to indicate there have a character pending to read.

Thus, read a character from nulldev serial will result in continuous
getting -EAGAIN return which might lead system to hang.

This commit is to fix a bug in nulldev serial which implement "pending"
function in nulldev serial to always indicate there is no character in
console that pending for read.

Signed-off-by: Wilson Lee <wilson.lee@ni.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Keng Soon Cheah <keng.soon.cheah@ni.com>
Cc: Chen Yee Chew <chen.yee.chew@ni.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
---

 drivers/serial/serial_nulldev.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/serial/serial_nulldev.c b/drivers/serial/serial_nulldev.c
index 0768308..17b2310 100644
--- a/drivers/serial/serial_nulldev.c
+++ b/drivers/serial/serial_nulldev.c
@@ -18,6 +18,11 @@ static int nulldev_serial_getc(struct udevice *dev)
 	return -EAGAIN;
 }
 
+static int nulldev_serial_pending(struct udevice *dev, bool input)
+{
+	return 0;
+}
+
 static int nulldev_serial_input(struct udevice *dev)
 {
 	return 0;
@@ -36,6 +41,7 @@ static const struct udevice_id nulldev_serial_ids[] = {
 
 const struct dm_serial_ops nulldev_serial_ops = {
 	.putc = nulldev_serial_putc,
+	.pending = nulldev_serial_pending,
 	.getc = nulldev_serial_getc,
 	.setbrg = nulldev_serial_setbrg,
 };
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] serial: nulldev: Implement "pending" function to fix tstc return "true"
  2017-11-03  6:39 [U-Boot] [PATCH] serial: nulldev: Implement "pending" function to fix tstc return "true" Wilson Lee
@ 2017-11-17 15:44 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2017-11-17 15:44 UTC (permalink / raw)
  To: u-boot

On Thu, Nov 02, 2017 at 11:39:51PM -0700, Wilson Lee wrote:

> In U-boot, serial_tstc was use to determine is there have a character in
> serial console that pending for read. If there is no "pending" function
> implemented in serial driver, the serial-uclass will return "true(1)"
> to indicate there have a character pending to read.
> 
> Thus, read a character from nulldev serial will result in continuous
> getting -EAGAIN return which might lead system to hang.
> 
> This commit is to fix a bug in nulldev serial which implement "pending"
> function in nulldev serial to always indicate there is no character in
> console that pending for read.
> 
> Signed-off-by: Wilson Lee <wilson.lee@ni.com>
> Cc: Joe Hershberger <joe.hershberger@ni.com>
> Cc: Keng Soon Cheah <keng.soon.cheah@ni.com>
> Cc: Chen Yee Chew <chen.yee.chew@ni.com>
> Cc: Bin Meng <bmeng.cn@gmail.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171117/26ca3459/attachment.sig>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-17 15:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-03  6:39 [U-Boot] [PATCH] serial: nulldev: Implement "pending" function to fix tstc return "true" Wilson Lee
2017-11-17 15:44 ` [U-Boot] " Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.