Commit e7bfb1db authored by Nathan Laredo's avatar Nathan Laredo Committed by Linus Torvalds

[PATCH] stradis.c "proper" port to 2.5.x

parent c98a2447
...@@ -247,7 +247,7 @@ const struct bttv_tvnorm bttv_tvnorms[] = { ...@@ -247,7 +247,7 @@ const struct bttv_tvnorm bttv_tvnorms[] = {
},{ },{
.v4l2_id = V4L2_STD_PAL_N, .v4l2_id = V4L2_STD_PAL_N,
.name = "PAL-N", .name = "PAL-N",
.Fsc 35468950, .Fsc = 35468950,
.swidth = 768, .swidth = 768,
.sheight = 576, .sheight = 576,
.totalwidth = 1135, .totalwidth = 1135,
......
...@@ -241,12 +241,6 @@ static void attach_inform(struct saa7146 *saa, int id) ...@@ -241,12 +241,6 @@ static void attach_inform(struct saa7146 *saa, int id)
} }
} }
static void detach_inform(struct saa7146 *saa, int id)
{
int i;
i = saa->nr;
}
static void I2CBusScan(struct saa7146 *saa) static void I2CBusScan(struct saa7146 *saa)
{ {
int i; int i;
...@@ -1323,9 +1317,12 @@ static void make_clip_tab(struct saa7146 *saa, struct video_clip *cr, int ncr) ...@@ -1323,9 +1317,12 @@ static void make_clip_tab(struct saa7146 *saa, struct video_clip *cr, int ncr)
clip_draw_rectangle(clipmap, 0, 0, 1024, -(saa->win.y)); 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_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long argl)
{ {
struct saa7146 *saa = (struct saa7146 *) dev; struct saa7146 *saa = file->private_data;
void *arg = (void *)argl;
switch (cmd) { switch (cmd) {
case VIDIOCGCAP: case VIDIOCGCAP:
{ {
...@@ -1809,24 +1806,23 @@ static int saa_ioctl(struct video_device *dev, unsigned int cmd, void *arg) ...@@ -1809,24 +1806,23 @@ static int saa_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
return 0; return 0;
} }
static int saa_mmap(struct video_device *dev, const char *adr, static int saa_mmap(struct file *file, struct vm_area_struct *vma)
unsigned long size)
{ {
struct saa7146 *saa = (struct saa7146 *) dev; struct saa7146 *saa = file->private_data;
printk(KERN_DEBUG "stradis%d: saa_mmap called\n", saa->nr); printk(KERN_DEBUG "stradis%d: saa_mmap called\n", saa->nr);
return -EINVAL; return -EINVAL;
} }
static long saa_read(struct video_device *dev, char *buf, static ssize_t saa_read(struct file *file, char *buf,
unsigned long count, int nonblock) size_t count, loff_t *ppos)
{ {
return -EINVAL; return -EINVAL;
} }
static long saa_write(struct video_device *dev, const char *buf, static ssize_t saa_write(struct file *file, const char *buf,
unsigned long count, int nonblock) size_t count, loff_t *ppos)
{ {
struct saa7146 *saa = (struct saa7146 *) dev; struct saa7146 *saa = file->private_data;
unsigned long todo = count; unsigned long todo = count;
int blocksize, split; int blocksize, split;
unsigned long flags; unsigned long flags;
...@@ -1945,11 +1941,23 @@ static long saa_write(struct video_device *dev, const char *buf, ...@@ -1945,11 +1941,23 @@ static long saa_write(struct video_device *dev, const char *buf,
return count; 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 = NULL;
unsigned int minor = minor(inode->i_rdev);
int i;
for (i = 0; i < SAA7146_MAX; i++) {
if (saa7146s[i].video_dev.minor == minor) {
saa = &saa7146s[i];
}
}
if (saa == NULL) {
return -ENODEV;
}
file->private_data = saa;
saa->video_dev.busy = 0; //saa->video_dev.busy = 0; /* old hack to support multiple open */
saa->user++; saa->user++;
if (saa->user > 1) if (saa->user > 1)
return 0; /* device open already, don't reset */ return 0; /* device open already, don't reset */
...@@ -1957,31 +1965,39 @@ static int saa_open(struct video_device *dev, int flags) ...@@ -1957,31 +1965,39 @@ static int saa_open(struct video_device *dev, int flags)
return 0; return 0;
} }
static void saa_close(struct video_device *dev) static int saa_release(struct inode *inode, struct file *file)
{ {
struct saa7146 *saa = (struct saa7146 *) dev; struct saa7146 *saa = file->private_data;
saa->user--; saa->user--;
saa->video_dev.busy = 0; //saa->video_dev.busy = 0; /* old hack to support multiple open */
if (saa->user > 0) /* still someone using device */ if (saa->user > 0) /* still someone using device */
return; return 0;
saawrite(0x007f0000, SAA7146_MC1); /* stop all overlay dma */ saawrite(0x007f0000, SAA7146_MC1); /* stop all overlay dma */
return 0;
} }
/* template for video_device-structure */ static struct file_operations saa_fops =
static struct video_device saa_template =
{ {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "SAA7146A",
.type = VID_TYPE_CAPTURE | VID_TYPE_OVERLAY,
.hardware = VID_HARDWARE_SAA7146,
.open = saa_open, .open = saa_open,
.close = saa_close, .release = saa_release,
.ioctl = saa_ioctl,
.read = saa_read, .read = saa_read,
.llseek = no_llseek,
.write = saa_write, .write = saa_write,
.ioctl = saa_ioctl,
.mmap = saa_mmap, .mmap = saa_mmap,
}; };
/* template for video_device-structure */
static struct video_device saa_template =
{
.name = "SAA7146A",
.type = VID_TYPE_CAPTURE | VID_TYPE_OVERLAY,
.hardware = VID_HARDWARE_SAA7146,
.fops = &saa_fops,
.minor = -1,
};
static int configure_saa7146(struct pci_dev *dev, int num) static int configure_saa7146(struct pci_dev *dev, int num)
{ {
int result; int result;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment