Merge branch 'master' into upstream
[sfrench/cifs-2.6.git] / drivers / media / video / pvrusb2 / pvrusb2-i2c-core.c
index c8d0bdee3ff1955bb4348e3acd1fb2f68d5bab70..3b9012f8e380671a8595b9bf9847bcc6f2c58242 100644 (file)
@@ -37,6 +37,10 @@ static unsigned int i2c_scan = 0;
 module_param(i2c_scan, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time");
 
+static unsigned int pvr2_i2c_client_describe(struct pvr2_i2c_client *cp,
+                                            unsigned int detail,
+                                            char *buf,unsigned int maxlen);
+
 static int pvr2_i2c_write(struct pvr2_hdw *hdw, /* Context */
                          u8 i2c_addr,      /* I2C address we're talking to */
                          u8 *data,         /* Data to write */
@@ -165,12 +169,12 @@ static int pvr2_i2c_read(struct pvr2_hdw *hdw, /* Context */
 
 /* This is the common low level entry point for doing I2C operations to the
    hardware. */
-int pvr2_i2c_basic_op(struct pvr2_hdw *hdw,
-                     u8 i2c_addr,
-                     u8 *wdata,
-                     u16 wlen,
-                     u8 *rdata,
-                     u16 rlen)
+static int pvr2_i2c_basic_op(struct pvr2_hdw *hdw,
+                            u8 i2c_addr,
+                            u8 *wdata,
+                            u16 wlen,
+                            u8 *rdata,
+                            u16 rlen)
 {
        if (!rdata) rlen = 0;
        if (!wdata) wlen = 0;
@@ -181,8 +185,6 @@ int pvr2_i2c_basic_op(struct pvr2_hdw *hdw,
        }
 }
 
-#ifdef CONFIG_VIDEO_PVRUSB2_24XXX
-
 /* This is a special entry point that is entered if an I2C operation is
    attempted to a wm8775 chip on model 24xxx hardware.  Autodetect of this
    part doesn't work, but we know it is really there.  So let's look for
@@ -267,7 +269,7 @@ static int i2c_hack_cx25840(struct pvr2_hdw *hdw,
                           "WARNING: Disabling further access to the device"
                           " to prevent other foul-ups.");
                // This blocks all further communication with the part.
-               hdw->i2c_func[0x44] = 0;
+               hdw->i2c_func[0x44] = NULL;
                pvr2_hdw_render_useless(hdw);
                goto fail;
        }
@@ -285,8 +287,6 @@ static int i2c_hack_cx25840(struct pvr2_hdw *hdw,
        return -EIO;
 }
 
-#endif /* CONFIG_VIDEO_PVRUSB2_24XXX */
-
 /* This is a very, very limited I2C adapter implementation.  We can only
    support what we actually know will work on the device... */
 static int pvr2_i2c_xfer(struct i2c_adapter *i2c_adap,
@@ -294,7 +294,7 @@ static int pvr2_i2c_xfer(struct i2c_adapter *i2c_adap,
                         int num)
 {
        int ret = -ENOTSUPP;
-       pvr2_i2c_func funcp = 0;
+       pvr2_i2c_func funcp = NULL;
        struct pvr2_hdw *hdw = (struct pvr2_hdw *)(i2c_adap->algo_data);
 
        if (!num) {
@@ -319,7 +319,7 @@ static int pvr2_i2c_xfer(struct i2c_adapter *i2c_adap,
                        u16 tcnt,bcnt,offs;
                        if (!msgs[0].len) {
                                /* Length == 0 read.  This is a probe. */
-                               if (funcp(hdw,msgs[0].addr,0,0,0,0)) {
+                               if (funcp(hdw,msgs[0].addr,NULL,0,NULL,0)) {
                                        ret = -EIO;
                                        goto done;
                                }
@@ -336,7 +336,7 @@ static int pvr2_i2c_xfer(struct i2c_adapter *i2c_adap,
                                if (bcnt > sizeof(hdw->cmd_buffer)-1) {
                                        bcnt = sizeof(hdw->cmd_buffer)-1;
                                }
-                               if (funcp(hdw,msgs[0].addr,0,0,
+                               if (funcp(hdw,msgs[0].addr,NULL,0,
                                          msgs[0].buf+offs,bcnt)) {
                                        ret = -EIO;
                                        goto done;
@@ -350,7 +350,7 @@ static int pvr2_i2c_xfer(struct i2c_adapter *i2c_adap,
                        /* Simple write */
                        ret = 1;
                        if (funcp(hdw,msgs[0].addr,
-                                 msgs[0].buf,msgs[0].len,0,0)) {
+                                 msgs[0].buf,msgs[0].len,NULL,0)) {
                                ret = -EIO;
                        }
                        goto done;
@@ -705,9 +705,9 @@ int pvr2_i2c_core_check_stale(struct pvr2_hdw *hdw)
        return (hdw->i2c_pend_types & PVR2_I2C_PEND_ALL) != 0;
 }
 
-unsigned int pvr2_i2c_client_describe(struct pvr2_i2c_client *cp,
-                                     unsigned int detail,
-                                     char *buf,unsigned int maxlen)
+static unsigned int pvr2_i2c_client_describe(struct pvr2_i2c_client *cp,
+                                            unsigned int detail,
+                                            char *buf,unsigned int maxlen)
 {
        unsigned int ccnt,bcnt;
        int spcfl = 0;
@@ -871,7 +871,7 @@ static void do_i2c_scan(struct pvr2_hdw *hdw)
        msg[0].addr = 0;
        msg[0].flags = I2C_M_RD;
        msg[0].len = 0;
-       msg[0].buf = 0;
+       msg[0].buf = NULL;
        printk("%s: i2c scan beginning\n",hdw->name);
        for (i = 0; i < 128; i++) {
                msg[0].addr = i;
@@ -893,14 +893,12 @@ void pvr2_i2c_core_init(struct pvr2_hdw *hdw)
                hdw->i2c_func[idx] = pvr2_i2c_basic_op;
        }
 
-#ifdef CONFIG_VIDEO_PVRUSB2_24XXX
        // If however we're dealing with new hardware, insert some hacks in
        // the I2C transfer stack to let things work better.
        if (hdw->hdw_type == PVR2_HDW_TYPE_24XXX) {
                hdw->i2c_func[0x1b] = i2c_hack_wm8775;
                hdw->i2c_func[0x44] = i2c_hack_cx25840;
        }
-#endif
 
        // Configure the adapter and set up everything else related to it.
        memcpy(&hdw->i2c_adap,&pvr2_i2c_adap_template,sizeof(hdw->i2c_adap));