fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / media / video / hexium_orion.c
index 1a3bbb6..137c473 100644 (file)
@@ -3,7 +3,7 @@
 
     Visit http://www.mihu.de/linux/saa7146/ and follow the link
     to "hexium" for further details about this card.
-    
+
     Copyright (C) 2003 Michael Hunold <michael@mihu.de>
 
     This program is free software; you can redistribute it and/or modify
@@ -26,7 +26,7 @@
 #include <media/saa7146_vv.h>
 
 static int debug = 0;
-MODULE_PARM(debug, "i");
+module_param(debug, int, 0);
 MODULE_PARM_DESC(debug, "debug verbosity");
 
 /* global variables */
@@ -68,8 +68,9 @@ static struct saa7146_extension_ioctls ioctls[] = {
 struct hexium
 {
        int type;
-       struct video_device     video_dev;
-       struct i2c_adapter      i2c_adapter;    
+       struct video_device     *video_dev;
+       struct i2c_adapter      i2c_adapter;
+
        int cur_input;  /* current input */
 };
 
@@ -85,7 +86,7 @@ static u8 hexium_saa7110[53]={
 };
 
 static struct {
-       struct hexium_data data[8];     
+       struct hexium_data data[8];
 } hexium_input_select[] = {
 {
        { /* cvbs 1 */
@@ -152,7 +153,7 @@ static struct {
                { 0x30, 0x60 },
                { 0x31, 0xB5 }, // ??
                { 0x21, 0x03 },
-       } 
+       }
 }, {
        { /* y/c 1 */
                { 0x06, 0x80 },
@@ -186,7 +187,7 @@ static struct {
                { 0x31, 0x75 },
                { 0x21, 0x21 },
        }
-}      
+}
 };
 
 static struct saa7146_standard hexium_standards[] = {
@@ -206,13 +207,13 @@ static struct saa7146_standard hexium_standards[] = {
                .h_offset       = 1,    .h_pixels       = 720,
                .v_max_out      = 576,  .h_max_out      = 768,
        }
-};             
+};
 
 /* this is only called for old HV-PCI6/Orion cards
    without eeprom */
 static int hexium_probe(struct saa7146_dev *dev)
 {
-       struct hexium *hexium = 0;
+       struct hexium *hexium = NULL;
        union i2c_smbus_data data;
        int err = 0;
 
@@ -223,12 +224,11 @@ static int hexium_probe(struct saa7146_dev *dev)
                return -EFAULT;
        }
 
-       hexium = (struct hexium *) kmalloc(sizeof(struct hexium), GFP_KERNEL);
+       hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL);
        if (NULL == hexium) {
                printk("hexium_orion: hexium_probe: not enough kernel memory.\n");
                return -ENOMEM;
        }
-       memset(hexium, 0x0, sizeof(struct hexium));
 
        /* enable i2c-port pins */
        saa7146_write(dev, MC1, (MASK_08 | MASK_24 | MASK_10 | MASK_26));
@@ -237,7 +237,11 @@ static int hexium_probe(struct saa7146_dev *dev)
        saa7146_write(dev, DD1_STREAM_B, 0x00000000);
        saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26));
 
-       saa7146_i2c_adapter_prepare(dev, &hexium->i2c_adapter, I2C_CLASS_TV_ANALOG, SAA7146_I2C_BUS_BIT_RATE_480);
+       hexium->i2c_adapter = (struct i2c_adapter) {
+               .class = I2C_CLASS_TV_ANALOG,
+               .name = "hexium orion",
+       };
+       saa7146_i2c_adapter_prepare(dev, &hexium->i2c_adapter, SAA7146_I2C_BUS_BIT_RATE_480);
        if (i2c_add_adapter(&hexium->i2c_adapter) < 0) {
                DEB_S(("cannot register i2c-device. skipping.\n"));
                kfree(hexium);
@@ -268,7 +272,7 @@ static int hexium_probe(struct saa7146_dev *dev)
                return 0;
        }
 
-       /* check if this is an old hexium Orion card by looking at 
+       /* check if this is an old hexium Orion card by looking at
           a saa7110 at address 0x4e */
        if (0 == (err = i2c_smbus_xfer(&hexium->i2c_adapter, 0x4e, 0, I2C_SMBUS_READ, 0x00, I2C_SMBUS_BYTE_DATA, &data))) {
                printk("hexium_orion: device is a Hexium HV-PCI6/Orion (old).\n");
@@ -310,7 +314,7 @@ static int hexium_set_input(struct hexium *hexium, int input)
 {
        union i2c_smbus_data data;
        int i = 0;
-       
+
        DEB_D((".\n"));
 
        for (i = 0; i < 8; i++) {
@@ -371,7 +375,7 @@ static int hexium_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
        struct saa7146_dev *dev = fh->dev;
        struct hexium *hexium = (struct hexium *) dev->ext_priv;
 /*
-       struct saa7146_vv *vv = dev->vv_data; 
+       struct saa7146_vv *vv = dev->vv_data;
 */
        switch (cmd) {
        case VIDIOC_ENUMINPUT:
@@ -480,7 +484,7 @@ static struct saa7146_ext_vv vv_data = {
 };
 
 static struct saa7146_extension extension = {
-       .name = "hexium HV-PCI6/Orion",
+       .name = "hexium HV-PCI6 Orion",
        .flags = 0,             // SAA7146_USE_I2C_IRQ,
 
        .pci_tbl = &pci_tbl[0],
@@ -494,7 +498,7 @@ static struct saa7146_extension extension = {
        .irq_func = NULL,
 };
 
-int __init hexium_init_module(void)
+static int __init hexium_init_module(void)
 {
        if (0 != saa7146_register_extension(&extension)) {
                DEB_S(("failed to register extension.\n"));
@@ -504,7 +508,7 @@ int __init hexium_init_module(void)
        return 0;
 }
 
-void __exit hexium_cleanup_module(void)
+static void __exit hexium_cleanup_module(void)
 {
        saa7146_unregister_extension(&extension);
 }