From: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: laredo@gnu.org, linux-kernel@vger.kernel.org
Subject: Re: [patch] stradis fixes
Date: Fri, 27 Sep 2002 17:09:00 -0300 [thread overview]
Message-ID: <20020927200900.GD416@cathedrallabs.org> (raw)
In-Reply-To: <1033154224.16726.19.camel@irongate.swansea.linux.org.uk>
[-- Attachment #1: Type: text/plain, Size: 107 bytes --]
> Maybe you should ask why they are integers and what else is wrong ?
ok, I guess I found it (?)
--
aris
[-- Attachment #2: stradis.patch --]
[-- Type: text/plain, Size: 3710 bytes --]
--- linux-2.5.38-vanilla/drivers/media/video/stradis.c 2002-09-27 16:46:04.000000000 -0300
+++ linux-2.5.38/drivers/media/video/stradis.c 2002-09-27 16:59:57.000000000 -0300
@@ -241,12 +241,6 @@
}
}
-static void detach_inform(struct saa7146 *saa, int id)
-{
- int i;
- i = saa->nr;
-}
-
static void I2CBusScan(struct saa7146 *saa)
{
int i;
@@ -1323,9 +1317,10 @@
clip_draw_rectangle(clipmap, 0, 0, 1024, -(saa->win.y));
}
-static int saa_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
+static int saa_do_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
+ void *arg)
{
- struct saa7146 *saa = (struct saa7146 *) dev;
+ struct saa7146 *saa = (struct saa7146 *) file->private_data;
switch (cmd) {
case VIDIOCGCAP:
{
@@ -1579,7 +1574,7 @@
vu.radio = VIDEO_NO_UNIT;
vu.audio = VIDEO_NO_UNIT;
vu.teletext = VIDEO_NO_UNIT;
- if (copy_to_user((void *) arg, (void *) &vu, sizeof(vu)))
+ if (copy_to_user(arg, (void *) &vu, sizeof(vu)))
return -EFAULT;
return 0;
}
@@ -1806,24 +1801,22 @@
return 0;
}
-static int saa_mmap(struct video_device *dev, const char *adr,
- unsigned long size)
+static int saa_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
+ unsigned long arg)
{
- struct saa7146 *saa = (struct saa7146 *) dev;
- printk(KERN_DEBUG "stradis%d: saa_mmap called\n", saa->nr);
- return -EINVAL;
+ return video_usercopy(inode, file, cmd, arg, saa_do_ioctl);
}
-static long saa_read(struct video_device *dev, char *buf,
- unsigned long count, int nonblock)
+static int saa_mmap(struct file *file, struct vm_area_struct *vm_area)
{
+ struct saa7146 *saa = (struct saa7146 *) file->private_data;
+ printk(KERN_DEBUG "stradis%d: saa_mmap called\n", saa->nr);
return -EINVAL;
}
-static long saa_write(struct video_device *dev, const char *buf,
- unsigned long count, int nonblock)
+static ssize_t saa_write(struct file *file, const char *buf, size_t count, loff_t *offset)
{
- struct saa7146 *saa = (struct saa7146 *) dev;
+ struct saa7146 *saa = (struct saa7146 *) file->private_data;
unsigned long todo = count;
int blocksize, split;
unsigned long flags;
@@ -1942,11 +1935,10 @@
return count;
}
-static int saa_open(struct video_device *dev, int flags)
+static int saa_open(struct inode *inode, struct file *file)
{
- struct saa7146 *saa = (struct saa7146 *) dev;
+ struct saa7146 *saa = (struct saa7146 *) file->private_data;
- saa->video_dev.busy = 0;
saa->user++;
if (saa->user > 1)
return 0; /* device open already, don't reset */
@@ -1954,16 +1946,25 @@
return 0;
}
-static void saa_close(struct video_device *dev)
+static ssize_t saa_close(struct inode *inode, struct file *file)
{
- struct saa7146 *saa = (struct saa7146 *) dev;
+ struct saa7146 *saa = (struct saa7146 *) file->private_data;
saa->user--;
- saa->video_dev.busy = 0;
- if (saa->user > 0) /* still someone using device */
- return;
- saawrite(0x007f0000, SAA7146_MC1); /* stop all overlay dma */
+ if (saa->user == 0)
+ saawrite(0x007f0000, SAA7146_MC1); /* stop all overlay dma */
+
+ return 0;
}
+static struct file_operations saa_fops =
+{
+ open: saa_open,
+ release: saa_close,
+ write: saa_write,
+ ioctl: saa_ioctl,
+ mmap: saa_mmap,
+};
+
/* template for video_device-structure */
static struct video_device saa_template =
{
@@ -1971,12 +1972,7 @@
name: "SAA7146A",
type: VID_TYPE_CAPTURE | VID_TYPE_OVERLAY,
hardware: VID_HARDWARE_SAA7146,
- open: saa_open,
- close: saa_close,
- read: saa_read,
- write: saa_write,
- ioctl: saa_ioctl,
- mmap: saa_mmap,
+ fops: &saa_fops,
};
static int configure_saa7146(struct pci_dev *dev, int num)
prev parent reply other threads:[~2002-09-27 20:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-27 17:22 Aristeu Sergio Rozanski Filho
2002-09-27 17:55 ` Alan Cox
2002-09-27 18:33 ` Aristeu Sergio Rozanski Filho
2002-09-27 19:17 ` Alan Cox
2002-09-27 20:09 ` Aristeu Sergio Rozanski Filho [this message]
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=20020927200900.GD416@cathedrallabs.org \
--to=aris@cathedrallabs.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=laredo@gnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®