All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
To: unlisted-recipients:; (no To-header on input)@bombadil.infradead.org
Cc: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	Al Viro <viro@zeniv.linux.org.uk>
Subject: [PATCH 2/6] media: saa7164: fix return codes for the polling routine
Date: Wed,  8 Aug 2018 10:52:52 -0400	[thread overview]
Message-ID: <899042a97eedf25c7d648d80f8b6d5dfbcb837e5.1533739965.git.mchehab+samsung@kernel.org> (raw)
In-Reply-To: <577a6299b1881c011bb82adb8a321ce72599a33c.1533739965.git.mchehab+samsung@kernel.org>
In-Reply-To: <577a6299b1881c011bb82adb8a321ce72599a33c.1533739965.git.mchehab+samsung@kernel.org>

All poll handlers should return a poll flag, and not error codes. So,
instead of returning an error, do the right thing at saa7164,
e. g. to return EPOLERR on errors, just like the V4L2 VB2 code.

Solves the following sparse warnings:
    drivers/media/pci/saa7164/saa7164-vbi.c:632:24: warning: incorrect type in return expression (different base types)
    drivers/media/pci/saa7164/saa7164-vbi.c:632:24:    expected restricted __poll_t
    drivers/media/pci/saa7164/saa7164-vbi.c:632:24:    got int
    drivers/media/pci/saa7164/saa7164-vbi.c:637:40: warning: incorrect type in return expression (different base types)
    drivers/media/pci/saa7164/saa7164-vbi.c:637:40:    expected restricted __poll_t
    drivers/media/pci/saa7164/saa7164-vbi.c:637:40:    got int
    drivers/media/pci/saa7164/saa7164-vbi.c:647:40: warning: incorrect type in return expression (different base types)
    drivers/media/pci/saa7164/saa7164-vbi.c:647:40:    expected restricted __poll_t
    drivers/media/pci/saa7164/saa7164-vbi.c:647:40:    got int

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
---
 drivers/media/pci/saa7164/saa7164-vbi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/pci/saa7164/saa7164-vbi.c b/drivers/media/pci/saa7164/saa7164-vbi.c
index 64ab91c24c18..221de91a8bae 100644
--- a/drivers/media/pci/saa7164/saa7164-vbi.c
+++ b/drivers/media/pci/saa7164/saa7164-vbi.c
@@ -629,12 +629,12 @@ static __poll_t fops_poll(struct file *file, poll_table *wait)
 		port->last_poll_msecs_diff);
 
 	if (!video_is_registered(port->v4l_device))
-		return -EIO;
+		return EPOLLERR;
 
 	if (atomic_cmpxchg(&fh->v4l_reading, 0, 1) == 0) {
 		if (atomic_inc_return(&port->v4l_reader_count) == 1) {
 			if (saa7164_vbi_initialize(port) < 0)
-				return -EINVAL;
+				return EPOLLERR;
 			saa7164_vbi_start_streaming(port);
 			msleep(200);
 		}
@@ -644,7 +644,7 @@ static __poll_t fops_poll(struct file *file, poll_table *wait)
 	if ((file->f_flags & O_NONBLOCK) == 0) {
 		if (wait_event_interruptible(port->wait_read,
 			saa7164_vbi_next_buf(port))) {
-				return -ERESTARTSYS;
+				return EPOLLERR;
 		}
 	}
 
-- 
2.17.1

  reply	other threads:[~2018-08-08 17:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-08 14:52 [PATCH 1/6] media: exynos-gsc: fix return code if mutex was interrupted Mauro Carvalho Chehab
2018-08-08 14:52 ` Mauro Carvalho Chehab
2018-08-08 14:52 ` Mauro Carvalho Chehab
2018-08-08 14:52 ` Mauro Carvalho Chehab [this message]
2018-08-08 14:52 ` [PATCH 3/6] media: s3c-camif: fix return code for the polling routine Mauro Carvalho Chehab
2018-08-08 14:52 ` [PATCH 4/6] media: radio-wl1273: " Mauro Carvalho Chehab
2018-08-08 14:52 ` [PATCH 5/6] media: isp: fix a warning about a wrong struct initializer Mauro Carvalho Chehab
2018-08-08 15:45   ` Laurent Pinchart
2018-09-07 11:46     ` Laurent Pinchart
2018-09-11 15:30       ` Laurent Pinchart
2018-09-20 14:44       ` Mauro Carvalho Chehab
2018-09-20 17:20         ` Laurent Pinchart
2018-08-08 14:52 ` [PATCH 6/6] siano: get rid of an unused return code for debugfs register Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=899042a97eedf25c7d648d80f8b6d5dfbcb837e5.1533739965.git.mchehab+samsung@kernel.org \
    --to=mchehab+samsung@kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.