X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=drivers%2Fmedia%2Fvideo%2Fzoran_card.c;h=246e67cd8b51c1710586c28c91e63adbe9d058e4;hb=987b0145d94eecf292d8b301228356f44611ab7c;hp=227ba2fb3f368f440fedc0553b72587e8a2c7425;hpb=20fcd31c96d8a7938e49ec2bc2249a5256b1ab2f;p=linux-2.6.git diff --git a/drivers/media/video/zoran_card.c b/drivers/media/video/zoran_card.c index 227ba2fb3..246e67cd8 100644 --- a/drivers/media/video/zoran_card.c +++ b/drivers/media/video/zoran_card.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -736,7 +737,7 @@ static struct i2c_algo_bit_data zoran_i2c_bit_data_template = { }; static struct i2c_adapter zoran_i2c_adapter_template = { - I2C_DEVNAME("zr36057"), + .name = "zr36057", .id = I2C_HW_B_ZR36067, .algo = NULL, .client_register = zoran_i2c_client_register, @@ -968,6 +969,7 @@ zoran_open_init_params (struct zoran *zr) static void __devinit test_interrupts (struct zoran *zr) { + DEFINE_WAIT(wait); int timeout, icr; clear_interrupt_counters(zr); @@ -975,7 +977,9 @@ test_interrupts (struct zoran *zr) zr->testing = 1; icr = btread(ZR36057_ICR); btwrite(0x78000000 | ZR36057_ICR_IntPinEn, ZR36057_ICR); - timeout = interruptible_sleep_on_timeout(&zr->test_q, 1 * HZ); + prepare_to_wait(&zr->test_q, &wait, TASK_INTERRUPTIBLE); + timeout = schedule_timeout(HZ); + finish_wait(&zr->test_q, &wait); btwrite(0, ZR36057_ICR); btwrite(0x78000000, ZR36057_ISR); zr->testing = 0; @@ -991,7 +995,7 @@ test_interrupts (struct zoran *zr) static int __devinit zr36057_init (struct zoran *zr) { - unsigned long mem; + u32 *mem; void *vdev; unsigned mem_needed; int j; @@ -1046,21 +1050,18 @@ zr36057_init (struct zoran *zr) /* allocate memory *before* doing anything to the hardware * in case allocation fails */ mem_needed = BUZ_NUM_STAT_COM * 4; - mem = (unsigned long) kmalloc(mem_needed, GFP_KERNEL); + mem = kzalloc(mem_needed, GFP_KERNEL); vdev = (void *) kmalloc(sizeof(struct video_device), GFP_KERNEL); if (!mem || !vdev) { dprintk(1, KERN_ERR "%s: zr36057_init() - kmalloc (STAT_COM) failed\n", ZR_DEVNAME(zr)); - if (vdev) - kfree(vdev); - if (mem) - kfree((void *)mem); + kfree(vdev); + kfree(mem); return -ENOMEM; } - memset((void *) mem, 0, mem_needed); - zr->stat_com = (u32 *) mem; + zr->stat_com = mem; for (j = 0; j < BUZ_NUM_STAT_COM; j++) { zr->stat_com[j] = 1; /* mark as unavailable to zr36057 */ } @@ -1101,15 +1102,15 @@ zoran_release (struct zoran *zr) /* unregister videocodec bus */ if (zr->codec) { struct videocodec_master *master = zr->codec->master_data; + videocodec_detach(zr->codec); - if (master) - kfree(master); + kfree(master); } if (zr->vfe) { struct videocodec_master *master = zr->vfe->master_data; + videocodec_detach(zr->vfe); - if (master) - kfree(master); + kfree(master); } /* unregister i2c bus */