diff options
author | Mike Isely <isely@pobox.com> | 2006-12-27 20:11:22 -0600 |
---|---|---|
committer | Mike Isely <isely@pobox.com> | 2006-12-27 20:11:22 -0600 |
commit | f30f0c8bacdc0ae575ec1a3b7f67fe1fc1c6ecf9 (patch) | |
tree | 8f74dfb5c9d80234d358616b18452ce7f834c4cf /linux | |
parent | 7ac7042e1d5a22709dfad7388e70d4d7a2cfd96b (diff) | |
download | mediapointer-dvb-s2-f30f0c8bacdc0ae575ec1a3b7f67fe1fc1c6ecf9.tar.gz mediapointer-dvb-s2-f30f0c8bacdc0ae575ec1a3b7f67fe1fc1c6ecf9.tar.bz2 |
pvrusb2: Use enumeration for minor number get / store code
From: Mike Isely <isely@pobox.com>
Signed-off-by: Mike Isely <isely@pobox.com>
Diffstat (limited to 'linux')
5 files changed, 28 insertions, 17 deletions
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h index 53283b7e9..966dd49f5 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h @@ -300,7 +300,8 @@ struct pvr2_hdw { /* Minor numbers used by v4l logic (yes, this is a hack, as there should be no v4l junk here). Probably a better way to do this. */ - int v4l_minor_number[3]; + int v4l_minor_number_mpeg; + int v4l_minor_number_radio; /* Location of eeprom or a negative number if none */ int eeprom_addr; diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 2217bb69e..4dea1e78f 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -1925,9 +1925,8 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, hdw->eeprom_addr = -1; hdw->unit_number = -1; - hdw->v4l_minor_number[0] = -1; - hdw->v4l_minor_number[1] = -1; - hdw->v4l_minor_number[2] = -1; + hdw->v4l_minor_number_mpeg = -1; + hdw->v4l_minor_number_radio = -1; hdw->ctl_write_buffer = kmalloc(PVR2_CTL_BUFFSIZE,GFP_KERNEL); if (!hdw->ctl_write_buffer) goto fail; hdw->ctl_read_buffer = kmalloc(PVR2_CTL_BUFFSIZE,GFP_KERNEL); @@ -2587,16 +2586,26 @@ int pvr2_hdw_cpufw_get(struct pvr2_hdw *hdw,unsigned int offs, } -int pvr2_hdw_v4l_get_minor_number(struct pvr2_hdw *hdw,int index) +int pvr2_hdw_v4l_get_minor_number(struct pvr2_hdw *hdw, + enum pvr2_config index) { - return hdw->v4l_minor_number[index]; + switch (index) { + case pvr2_config_mpeg: return hdw->v4l_minor_number_mpeg; + case pvr2_config_radio: return hdw->v4l_minor_number_radio; + default: return -1; + } } /* Store a v4l minor device number */ -void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *hdw,int index,int v) +void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *hdw, + enum pvr2_config index,int v) { - hdw->v4l_minor_number[index] = v; + switch (index) { + case pvr2_config_mpeg: hdw->v4l_minor_number_mpeg = v; + case pvr2_config_radio: hdw->v4l_minor_number_radio = v; + default: break; + } } diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h index 97db29224..b39fb01c8 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h @@ -215,10 +215,11 @@ int pvr2_hdw_cpufw_get(struct pvr2_hdw *,unsigned int offs, char *buf,unsigned int cnt); /* Retrieve a previously stored v4l minor device number */ -int pvr2_hdw_v4l_get_minor_number(struct pvr2_hdw *,int); +int pvr2_hdw_v4l_get_minor_number(struct pvr2_hdw *,enum pvr2_config index); /* Store a v4l minor device number */ -void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *,int,int); +void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *, + enum pvr2_config index,int); /* Direct read/write access to chip's registers: chip_id - unique id of chip (e.g. I2C_DRIVERD_xxxx) diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c index 3e0dd531a..e587416f3 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c @@ -733,7 +733,8 @@ static ssize_t v4l_minor_number_show(struct class_device *class_dev,char *buf) sfp = (struct pvr2_sysfs *)class_dev->class_data; if (!sfp) return -EINVAL; return scnprintf(buf,PAGE_SIZE,"%d\n", - pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw,0)); + pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, + pvr2_config_mpeg)); } @@ -744,7 +745,8 @@ static ssize_t v4l_radio_minor_number_show(struct class_device *class_dev, sfp = (struct pvr2_sysfs *)class_dev->class_data; if (!sfp) return -EINVAL; return scnprintf(buf,PAGE_SIZE,"%d\n", - pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw,2)); + pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, + pvr2_config_radio)); } diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index 307e82054..ba18b9680 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c @@ -741,11 +741,9 @@ static void pvr2_v4l2_dev_destroy(struct pvr2_v4l2_dev *dip) static void pvr2_v4l2_destroy_no_lock(struct pvr2_v4l2 *vp) { pvr2_hdw_v4l_store_minor_number(vp->channel.mc_head->hdw, - pvr2_config_mpeg-1,-1); + pvr2_config_mpeg,-1); pvr2_hdw_v4l_store_minor_number(vp->channel.mc_head->hdw, - pvr2_config_vbi-1,-1); - pvr2_hdw_v4l_store_minor_number(vp->channel.mc_head->hdw, - pvr2_config_radio-1,-1); + pvr2_config_radio,-1); pvr2_v4l2_dev_destroy(vp->vdev); pvr2_trace(PVR2_TRACE_STRUCT,"Destroying pvr2_v4l2 id=%p",vp); @@ -1164,7 +1162,7 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip, } pvr2_hdw_v4l_store_minor_number(vp->channel.mc_head->hdw, - cfg-1,dip->devbase.minor); + cfg,dip->devbase.minor); } |