All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Hunold (LinuxTV.org CVS maintainer) <hunold@linuxtv.org>
To: linux-kernel@vger.kernel.org
Subject: [PATCH 5/14] multiple device *read* opens support
Date: Wed, 8 Oct 2003 15:28:53 +0200	[thread overview]
Message-ID: <1065619733696@convergence.de> (raw)
In-Reply-To: <1065619733417@convergence.de>

- [DVB] allow multiple read device opens
diff -uNrwB --new-file xx-linux-2.6.0-test5/drivers/media/dvb/dvb-core/dvbdev.h linux-2.6.0-test5/drivers/media/dvb/dvb-core/dvbdev.h
--- xx-linux-2.6.0-test5/drivers/media/dvb/dvb-core/dvbdev.h	2003-09-10 11:28:41.000000000 +0200
+++ linux-2.6.0-test5/drivers/media/dvb/dvb-core/dvbdev.h	2003-08-25 12:16:12.000000000 +0200
@@ -55,12 +58,18 @@
 struct dvb_device {
 	struct list_head list_head;
 	struct file_operations *fops;
+ 
+ 
+ 
 	struct dvb_adapter *adapter;
 	int type;
 	u32 id;
 
-	int users;
+	/* in theory, 'users' can vanish now,
+	   but I don't want to change too much now... */
+	int readers;
 	int writers;
+	int users;
 
         /* don't really need those !? -- FIXME: use video_usercopy  */
         int (*kernel_ioctl)(struct inode *inode, struct file *file,
diff -uNrwB --new-file xx-linux-2.6.0-test5/drivers/media/dvb/dvb-core/dvbdev.c linux-2.6.0-test5/drivers/media/dvb/dvb-core/dvbdev.c
--- xx-linux-2.6.0-test5/drivers/media/dvb/dvb-core/dvbdev.c	2003-09-10 11:29:20.000000000 +0200
+++ linux-2.6.0-test5/drivers/media/dvb/dvb-core/dvbdev.c	2003-08-21 10:53:19.000000000 +0200
@@ -112,7 +121,11 @@
 	if (!dvbdev->users)
                 return -EBUSY;
 
-	if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
+	if ((file->f_flags & O_ACCMODE) == O_RDONLY) {
+                if (!dvbdev->readers)
+		        return -EBUSY;
+		dvbdev->readers--;
+	} else {
                 if (!dvbdev->writers)
 		        return -EBUSY;
 		dvbdev->writers--;
@@ -130,8 +143,11 @@
 	if (!dvbdev)
                 return -ENODEV;
 
-	if ((file->f_flags & O_ACCMODE) != O_RDONLY)
+	if ((file->f_flags & O_ACCMODE) == O_RDONLY) {
+		dvbdev->readers++;
+	} else {
 		dvbdev->writers++;
+	}
 
 	dvbdev->users++;
 	return 0;
diff -uNrwB --new-file xx-linux-2.6.0-test5/drivers/media/dvb/dvb-core/dvb_frontend.c linux-2.6.0-test5/drivers/media/dvb/dvb-core/dvb_frontend.c
--- xx-linux-2.6.0-test5/drivers/media/dvb/dvb-core/dvb_frontend.c	2003-09-10 11:28:54.000000000 +0200
+++ linux-2.6.0-test5/drivers/media/dvb/dvb-core/dvb_frontend.c	2003-09-09 09:24:21.000000000 +0200
@@ -870,6 +886,7 @@
 	static const struct dvb_device dvbdev_template = {
 		.users = ~0,
 		.writers = 1,
+		.readers = (~0)-1,
 		.fops = &dvb_frontend_fops,
 		.kernel_ioctl = dvb_frontend_ioctl
 	};



  reply	other threads:[~2003-10-08 13:35 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-08 13:28 [PATCH 1/14] LinuxTV.org DVB driver update Michael Hunold
2003-10-08 13:28 ` [PATCH 2/14] firmware update for av7110 dvb driver Michael Hunold
2003-10-08 13:28   ` [PATCH 3/14] add new DVB-T frontend driver Michael Hunold
2003-10-08 13:28     ` [PATCH 4/14] video capture updates for saa7146 core Michael Hunold
2003-10-08 13:28       ` Michael Hunold [this message]
2003-10-08 13:28         ` [PATCH 6/14] update copyright and licensing Michael Hunold
2003-10-08 13:28           ` [PATCH 7/14] usual c99 initializer fixes Michael Hunold
2003-10-08 13:28             ` [PATCH 8/14] various patches for non-av7110 dvb-drivers Michael Hunold
2003-10-08 13:28               ` [PATCH 9/14] various av7110 dvb-driver updates Michael Hunold
2003-10-08 13:28                 ` [PATCH 10/14] update dvb frontend drivers Michael Hunold
2003-10-08 13:28                   ` [PATCH 11/14] Kconfig and Makefile updates, inspired by Adrian Bunk and Roman Zippel Michael Hunold
2003-10-08 13:28                     ` [PATCH 12/14] some more av7110 dvb-driver updates Michael Hunold
2003-10-08 13:29                       ` [PATCH 13/14] fix v4l1 backward compatibility in saa7146 driver Michael Hunold
2003-10-08 13:29                         ` [PATCH 14/14] firmware blob for new DVB-T frontend driver Michael Hunold
2003-10-08 14:45   ` [PATCH 2/14] firmware update for av7110 dvb driver Marcel Holtmann
2003-10-08 15:36     ` Michael Hunold
2003-10-08 15:54       ` Michael Hunold
2003-10-12 21:42         ` Manuel Estrada Sainz
2003-10-11 11:59     ` Jochen Friedrich
2003-10-10 20:15 ` [PATCH 1/14] LinuxTV.org DVB driver update Stephen Hemminger
2003-10-11  8:41   ` Michael Hunold
2003-10-11 17:53     ` David S. Miller
2003-10-12  9:16       ` Geert Uytterhoeven
2003-10-12 11:08         ` Sam Ravnborg
2003-10-12 20:14           ` Michael Hunold
2003-10-13 16:01           ` Stephen Hemminger
2003-10-14  9:59             ` Michael Hunold
2003-10-12 20:10         ` Michael Hunold

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=1065619733696@convergence.de \
    --to=hunold@linuxtv.org \
    --cc=linux-kernel@vger.kernel.org \
    /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.