]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
V4L/DVB (5041): Pvrusb2: Use separate enumeration for get/store of minor number
authorMike Isely <isely@pobox.com>
Thu, 28 Dec 2006 02:12:28 +0000 (23:12 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Wed, 21 Feb 2007 15:34:24 +0000 (13:34 -0200)
Use separate enum for get/store of minor number; we want pvr2_config
to go away eventually and since it really means something different,
don't use it here

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
drivers/media/video/pvrusb2/pvrusb2-hdw.c
drivers/media/video/pvrusb2/pvrusb2-hdw.h
drivers/media/video/pvrusb2/pvrusb2-sysfs.c
drivers/media/video/pvrusb2/pvrusb2-v4l2.c

index e6d546f56d311aa2432996d7af92f4210838bc9a..746d174d0b0d4b2cb7381c1c43474fac108774a8 100644 (file)
@@ -283,7 +283,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_mpeg;
+       int v4l_minor_number_video;
+       int v4l_minor_number_vbi;
        int v4l_minor_number_radio;
 
        /* Location of eeprom or a negative number if none */
index 6acd73ca9ed34a83792247cc80f30419f1791fda..39d04d8644a80820655196b4ac980e1e6b109cc7 100644 (file)
@@ -1898,7 +1898,8 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
 
        hdw->eeprom_addr = -1;
        hdw->unit_number = -1;
-       hdw->v4l_minor_number_mpeg = -1;
+       hdw->v4l_minor_number_video = -1;
+       hdw->v4l_minor_number_vbi = -1;
        hdw->v4l_minor_number_radio = -1;
        hdw->ctl_write_buffer = kmalloc(PVR2_CTL_BUFFSIZE,GFP_KERNEL);
        if (!hdw->ctl_write_buffer) goto fail;
@@ -2548,11 +2549,12 @@ int pvr2_hdw_cpufw_get(struct pvr2_hdw *hdw,unsigned int offs,
 
 
 int pvr2_hdw_v4l_get_minor_number(struct pvr2_hdw *hdw,
-                                 enum pvr2_config index)
+                                 enum pvr2_v4l_type index)
 {
        switch (index) {
-       case pvr2_config_mpeg: return hdw->v4l_minor_number_mpeg;
-       case pvr2_config_radio: return hdw->v4l_minor_number_radio;
+       case pvr2_v4l_type_video: return hdw->v4l_minor_number_video;
+       case pvr2_v4l_type_vbi: return hdw->v4l_minor_number_vbi;
+       case pvr2_v4l_type_radio: return hdw->v4l_minor_number_radio;
        default: return -1;
        }
 }
@@ -2560,11 +2562,12 @@ int pvr2_hdw_v4l_get_minor_number(struct pvr2_hdw *hdw,
 
 /* Store a v4l minor device number */
 void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *hdw,
-                                    enum pvr2_config index,int v)
+                                    enum pvr2_v4l_type index,int v)
 {
        switch (index) {
-       case pvr2_config_mpeg: hdw->v4l_minor_number_mpeg = v;
-       case pvr2_config_radio: hdw->v4l_minor_number_radio = v;
+       case pvr2_v4l_type_video: hdw->v4l_minor_number_video = v;
+       case pvr2_v4l_type_vbi: hdw->v4l_minor_number_vbi = v;
+       case pvr2_v4l_type_radio: hdw->v4l_minor_number_radio = v;
        default: break;
        }
 }
index fa3769a244a1a238fed4be8332f5bc154c769df3..19af4d636c3ff3aac9e5383ea33c9a4cee7a1cae 100644 (file)
@@ -78,6 +78,12 @@ enum pvr2_config {
        pvr2_config_radio,
 };
 
+enum pvr2_v4l_type {
+       pvr2_v4l_type_video,
+       pvr2_v4l_type_vbi,
+       pvr2_v4l_type_radio,
+};
+
 const char *pvr2_config_get_name(enum pvr2_config);
 
 struct pvr2_hdw;
@@ -206,11 +212,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 *,enum pvr2_config index);
+int pvr2_hdw_v4l_get_minor_number(struct pvr2_hdw *,enum pvr2_v4l_type index);
 
 /* Store a v4l minor device number */
 void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *,
-                                    enum pvr2_config index,int);
+                                    enum pvr2_v4l_type index,int);
 
 /* Direct read/write access to chip's registers:
    chip_id - unique id of chip (e.g. I2C_DRIVERD_xxxx)
index 0f8021e2dd068d1078bd71dd4403c66d662cd804..a3af24320e73392a2d1c1ccab6c23372566843e6 100644 (file)
@@ -733,7 +733,7 @@ static ssize_t v4l_minor_number_show(struct class_device *class_dev,char *buf)
        if (!sfp) return -EINVAL;
        return scnprintf(buf,PAGE_SIZE,"%d\n",
                         pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw,
-                                                      pvr2_config_mpeg));
+                                                      pvr2_v4l_type_video));
 }
 
 
@@ -745,7 +745,7 @@ static ssize_t v4l_radio_minor_number_show(struct class_device *class_dev,
        if (!sfp) return -EINVAL;
        return scnprintf(buf,PAGE_SIZE,"%d\n",
                         pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw,
-                                                      pvr2_config_radio));
+                                                      pvr2_v4l_type_radio));
 }
 
 
index 4acbbc71f7e00cc6e84da2ac1cbd5de482698f2d..3a2a0ca33e90f816de59c1d4dc8e91cc8491f412 100644 (file)
@@ -725,9 +725,11 @@ 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);
+                                       pvr2_v4l_type_video,-1);
        pvr2_hdw_v4l_store_minor_number(vp->channel.mc_head->hdw,
-                                       pvr2_config_radio,-1);
+                                       pvr2_v4l_type_vbi,-1);
+       pvr2_hdw_v4l_store_minor_number(vp->channel.mc_head->hdw,
+                                       pvr2_v4l_type_radio,-1);
        pvr2_v4l2_dev_destroy(vp->vdev);
 
        pvr2_trace(PVR2_TRACE_STRUCT,"Destroying pvr2_v4l2 id=%p",vp);
@@ -1072,6 +1074,7 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip,
        int mindevnum;
        int unit_number;
        int v4l_type;
+       enum pvr2_v4l_type pvt;
        dip->v4lp = vp;
        dip->config = cfg;
 
@@ -1079,13 +1082,16 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip,
        switch (cfg) {
        case pvr2_config_mpeg:
                v4l_type = VFL_TYPE_GRABBER;
+               pvt = pvr2_v4l_type_video;
                dip->stream = &vp->channel.mc_head->video_stream;
                break;
        case pvr2_config_vbi:
                v4l_type = VFL_TYPE_VBI;
+               pvt = pvr2_v4l_type_vbi;
                break;
        case pvr2_config_radio:
                v4l_type = VFL_TYPE_RADIO;
+               pvt = pvr2_v4l_type_radio;
                break;
        default:
                /* Bail out (this should be impossible) */
@@ -1133,7 +1139,7 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip,
        }
 
        pvr2_hdw_v4l_store_minor_number(vp->channel.mc_head->hdw,
-                                       cfg,dip->devbase.minor);
+                                       pvt,dip->devbase.minor);
 }