From: Andrew Morton man, that was some pretty weird-looking stuff. Cc: Peter Skipworth Cc: Gerd Knorr Signed-off-by: Andrew Morton --- drivers/media/video/bttv-cards.c | 81 ++++++++++++++------------------------- 1 files changed, 31 insertions(+), 50 deletions(-) diff -puN drivers/media/video/bttv-cards.c~bttv-support-for-adlink-rtv24-capture-card-tidy drivers/media/video/bttv-cards.c --- 25/drivers/media/video/bttv-cards.c~bttv-support-for-adlink-rtv24-capture-card-tidy 2005-05-17 01:07:00.000000000 -0700 +++ 25-akpm/drivers/media/video/bttv-cards.c 2005-05-17 01:07:00.000000000 -0700 @@ -2763,7 +2763,7 @@ void __devinit bttv_init_card2(struct bt kodicom4400r_init(btv); break; case BTTV_ADLINK_RTV24: - init_RTV24( btv ); + init_RTV24(btv); break; } @@ -3350,66 +3350,47 @@ static void __devinit init_PXC200(struct /* ----------------------------------------------------------------------- */ void init_RTV24(struct bttv *btv) { - uint32_t dataRead = 0; + u32 dataRead = 0; long watchdog_value = 0x0E; - printk( - KERN_INFO - "bttv%d: Adlink RTV-24 initialisation in progress ...\n", - btv->c.nr - ); - - btwrite( 0x00c3feff, BT848_GPIO_OUT_EN ); - - btwrite( 0 + watchdog_value, BT848_GPIO_DATA ); - msleep( 1 ); - btwrite( 0x10 + watchdog_value, BT848_GPIO_DATA ); - msleep( 10 ); - btwrite( 0 + watchdog_value, BT848_GPIO_DATA ); - - dataRead = btread( BT848_GPIO_DATA ); + printk(KERN_INFO "bttv%d: Adlink RTV-24 initialisation in progress\n", + btv->c.nr); - if ( ( ( ( dataRead >> 18 ) & 0x01 ) != 0 ) || - ( ( ( dataRead >> 19 ) & 0x01 ) != 1 ) - ) - { - printk( - KERN_INFO - "bttv%d: Adlink RTV-24 initialisation(1) ERROR_CPLD_Check_Failed (read %d)\n", - btv->c.nr, dataRead - ); - } + btwrite(0x00c3feff, BT848_GPIO_OUT_EN); - btwrite( 0x4400 + watchdog_value, BT848_GPIO_DATA ); + btwrite(0 + watchdog_value, BT848_GPIO_DATA); + msleep(1); + btwrite(0x10 + watchdog_value, BT848_GPIO_DATA); msleep( 10 ); - btwrite( 0x4410 + watchdog_value, BT848_GPIO_DATA ); - msleep( 1 ); - btwrite( watchdog_value, BT848_GPIO_DATA ); - msleep( 1 ); - dataRead = btread( BT848_GPIO_DATA ); - - if ( ( ( ( dataRead >> 18 ) & 0x01 ) != 0 ) || - ( ( ( dataRead >> 19 ) & 0x01 ) != 0 ) - ) - { - printk( - KERN_INFO - "bttv%d: Adlink RTV-24 initialisation(2) ERROR_CPLD_Check_Failed (read %d)\n", - btv->c.nr, dataRead - ); + btwrite(0 + watchdog_value, BT848_GPIO_DATA); + dataRead = btread(BT848_GPIO_DATA); + + if (((dataRead >> 18) & 0x01) != 0 || ((dataRead >> 19) & 0x01) != 1) { + printk(KERN_INFO "bttv%d: Adlink RTV-24 initialisation(1) " + "ERROR_CPLD_Check_Failed (read %d)\n", + btv->c.nr, dataRead); + } + + btwrite(0x4400 + watchdog_value, BT848_GPIO_DATA); + msleep(10); + btwrite(0x4410 + watchdog_value, BT848_GPIO_DATA); + msleep(1); + btwrite(watchdog_value, BT848_GPIO_DATA); + msleep(1); + dataRead = btread(BT848_GPIO_DATA); + + if (((dataRead >> 18) & 0x01) != 0 || ((dataRead >> 19) & 0x01) != 0) { + printk(KERN_INFO "bttv%d: Adlink RTV-24 initialisation(2) " + "ERROR_CPLD_Check_Failed (read %d)\n", + btv->c.nr, dataRead); return; } - printk( - KERN_INFO - "bttv%d: Adlink RTV-24 initialisation complete.\n", - btv->c.nr - ); + printk(KERN_INFO "bttv%d: Adlink RTV-24 initialisation complete.\n", + btv->c.nr); } - - /* ----------------------------------------------------------------------- */ /* Miro Pro radio stuff -- the tea5757 is connected to some GPIO ports */ /* _