diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-08-01 15:57:52 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-08-01 15:57:52 -0300 |
commit | abaa970749baa324bff6aafcd123302f1cdc96aa (patch) | |
tree | 8a28358540c28331722029b73eab798e3488d1b5 /linux/drivers/media/radio/dsbr100.c | |
parent | 54e91faabed65dbc999715acfe8f0d9b939e851c (diff) | |
download | mediapointer-dvb-s2-abaa970749baa324bff6aafcd123302f1cdc96aa.tar.gz mediapointer-dvb-s2-abaa970749baa324bff6aafcd123302f1cdc96aa.tar.bz2 |
Cleanups and fixes for dsbr100
From: Alan Cox <alan@redhat.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/radio/dsbr100.c')
-rw-r--r-- | linux/drivers/media/radio/dsbr100.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/linux/drivers/media/radio/dsbr100.c b/linux/drivers/media/radio/dsbr100.c index f9fbb2020..c4e67e6c8 100644 --- a/linux/drivers/media/radio/dsbr100.c +++ b/linux/drivers/media/radio/dsbr100.c @@ -33,6 +33,9 @@ History: + Version 0.41-ac1: + Alan Cox: Some cleanups and fixes + Version 0.41: Converted to V4L2 API by Mauro Carvalho Chehab <mchehab@infradead.org> @@ -129,7 +132,7 @@ static int radio_nr = -1; module_param(radio_nr, int, 0); /* Data for one (physical) device */ -typedef struct { +struct dsbr100_device { struct usb_device *usbdev; struct video_device *videodev; unsigned char transfer_buffer[TB_LEN]; @@ -138,7 +141,7 @@ typedef struct { int users; int removed; int muted; -} dsbr100_device; +}; /* File system interface */ @@ -179,7 +182,7 @@ static struct usb_driver usb_dsbr100_driver = { /* Low-level device interface begins here */ /* switch on radio */ -static int dsbr100_start(dsbr100_device *radio) +static int dsbr100_start(struct dsbr100_device *radio) { if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), USB_REQ_GET_STATUS, @@ -196,7 +199,7 @@ static int dsbr100_start(dsbr100_device *radio) /* switch off radio */ -static int dsbr100_stop(dsbr100_device *radio) +static int dsbr100_stop(struct dsbr100_device *radio) { if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), USB_REQ_GET_STATUS, @@ -212,7 +215,7 @@ static int dsbr100_stop(dsbr100_device *radio) } /* set a frequency, freq is defined by v4l's TUNER_LOW, i.e. 1/16th kHz */ -static int dsbr100_setfreq(dsbr100_device *radio, int freq) +static int dsbr100_setfreq(struct dsbr100_device *radio, int freq) { freq = (freq/16*80)/1000+856; if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), @@ -237,7 +240,7 @@ static int dsbr100_setfreq(dsbr100_device *radio, int freq) /* return the device status. This is, in effect, just whether it sees a stereo signal or not. Pity. */ -static void dsbr100_getstat(dsbr100_device *radio) +static void dsbr100_getstat(struct dsbr100_device *radio) { if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), USB_REQ_GET_STATUS, @@ -256,9 +259,9 @@ usb if it is */ static int usb_dsbr100_probe(struct usb_interface *intf, const struct usb_device_id *id) { - dsbr100_device *radio; + struct dsbr100_device *radio; - if (!(radio = kmalloc(sizeof(dsbr100_device), GFP_KERNEL))) + if (!(radio = kmalloc(sizeof(struct dsbr100_device), GFP_KERNEL))) return -ENOMEM; if (!(radio->videodev = video_device_alloc())) { kfree(radio); @@ -291,7 +294,7 @@ code I'd expect I better did that, but if there's a memory leak here it's tiny (~50 bytes per disconnect) */ static void usb_dsbr100_disconnect(struct usb_interface *intf) { - dsbr100_device *radio = usb_get_intfdata(intf); + struct dsbr100_device *radio = usb_get_intfdata(intf); usb_set_intfdata (intf, NULL); if (radio) { @@ -311,7 +314,7 @@ static void usb_dsbr100_disconnect(struct usb_interface *intf) static int usb_dsbr100_do_ioctl(struct inode *inode, struct file *file, unsigned int cmd, void *arg) { - dsbr100_device *radio=video_get_drvdata(video_devdata(file)); + struct dsbr100_device *radio=video_get_drvdata(video_devdata(file)); if (!radio) return -EIO; @@ -344,15 +347,13 @@ static int usb_dsbr100_do_ioctl(struct inode *inode, struct file *file, v->rangelow = FREQ_MIN*FREQ_MUL; v->rangehigh = FREQ_MAX*FREQ_MUL; - - v->rxsubchans =V4L2_TUNER_SUB_MONO|V4L2_TUNER_SUB_STEREO; v->capability=V4L2_TUNER_CAP_LOW; if(radio->stereo) v->audmode = V4L2_TUNER_MODE_STEREO; else v->audmode = V4L2_TUNER_MODE_MONO; - v->signal = radio->stereo*0x7000; + v->signal = 0xFFFF; /* We can't get the signal strength */ return 0; } @@ -392,7 +393,7 @@ static int usb_dsbr100_do_ioctl(struct inode *inode, struct file *file, if (qc->id && qc->id == radio_qctrl[i].id) { memcpy(qc, &(radio_qctrl[i]), sizeof(*qc)); - return (0); + return 0; } } return -EINVAL; @@ -404,6 +405,7 @@ static int usb_dsbr100_do_ioctl(struct inode *inode, struct file *file, switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: ctrl->value=radio->muted; + return 0; } return -EINVAL; } @@ -420,12 +422,13 @@ static int usb_dsbr100_do_ioctl(struct inode *inode, struct file *file, if (dsbr100_start(radio)==-1) warn("Radio did not respond properly"); } - return (0); + return 0; } return -EINVAL; } default: - return -ENOIOCTLCMD; + return v4l_compat_translate_ioctl(inode,file,cmd,arg, + usb_dsbr100_do_ioctl); } } @@ -437,7 +440,7 @@ static int usb_dsbr100_ioctl(struct inode *inode, struct file *file, static int usb_dsbr100_open(struct inode *inode, struct file *file) { - dsbr100_device *radio=video_get_drvdata(video_devdata(file)); + struct dsbr100_device *radio=video_get_drvdata(video_devdata(file)); radio->users = 1; radio->muted = 1; @@ -453,7 +456,7 @@ static int usb_dsbr100_open(struct inode *inode, struct file *file) static int usb_dsbr100_close(struct inode *inode, struct file *file) { - dsbr100_device *radio=video_get_drvdata(video_devdata(file)); + struct dsbr100_device *radio=video_get_drvdata(video_devdata(file)); if (!radio) return -ENODEV; |