]> rtime.felk.cvut.cz Git - mf6xx.git/commitdiff
Minor changes.
authorRostislav Lisovy <lisovy@gmail.com>
Sun, 17 Apr 2011 23:53:08 +0000 (01:53 +0200)
committerRostislav Lisovy <lisovy@gmail.com>
Sun, 17 Apr 2011 23:53:08 +0000 (01:53 +0200)
src/comedi/mf624_simple_driver/kernel/mf624.c

index 71fa4a2cd06454e89cd6c2c89dc513c0d4174193..e92c21d4b9e60af26036653790db77388cb6791d 100755 (executable)
@@ -94,7 +94,7 @@ typedef unsigned int lsampl_t;
 #define MF624_GPIOC_DACEN      (1 << 26) /* Enable D/A outputs */
 
 
-typedef struct mf624_board_struct{
+typedef struct mf624_board_struct {
        char *name;
        unsigned short device_id;       
        unsigned int ai_chans;
@@ -116,7 +116,7 @@ static const mf624_board mf624_boards[] = {
                ao_bits:        14,             /* Num of DAC bits      */
                di_chans:       8,              /* Num of digital in    */
                do_chans:       8,              /* Num of digital out   */
-       },
+       }
 };
 
 /* Number of boards */
@@ -124,7 +124,7 @@ static const mf624_board mf624_boards[] = {
 
 
 /* Private data structure */
-typedef struct{
+typedef struct {
        int data;
 
        /* would be useful for a PCI device */
@@ -137,9 +137,9 @@ typedef struct{
        unsigned long BAR2;
        unsigned long BAR4;     
 
-       voidIO_BAR0;  
-       voidIO_BAR2;
-       voidIO_BAR4;  
+       void __iomem *IO_BAR0;  
+       void __iomem *IO_BAR2;
+       void __iomem *IO_BAR4;  
 
        /* Used for AO readback */
        lsampl_t ao_readback[8];
@@ -149,9 +149,9 @@ typedef struct{
 
 
 /* Attach/detach functions declaration */
-/*static int mf624_attach(struct comedi_device *dev, struct comedi_devconfig *it);
+static int mf624_attach(struct comedi_device *dev, struct comedi_devconfig *it);
 static int mf624_detach(struct comedi_device *dev);
-*/
+
 
 /* Analog functions operation to be attached */
 static int mf624_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, 
@@ -189,10 +189,7 @@ static int mf624_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        struct pci_dev* pcidev;
        unsigned int index, channel, status;
 
-       printk("comedi%d: mf624: driver: Bourgeot - Poulain 2006-2007\n", dev->minor);
-       printk("This is an experimental version, you can report \
-               some remarks or problems to fpoulain@gmail.com\n");
-
+       printk("comedi%d: mf624: ", dev->minor);
        
        /* Allocate the private structure area.  alloc_private() is a
           convenient macro defined in comedidev.h. */
@@ -203,14 +200,15 @@ static int mf624_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        /* Probe the device to determine what device in the series it is */
        for(pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); 
                pcidev != NULL; 
-               pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) {
+               pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev))
+               {
 
                if(pcidev->vendor != PCI_VENDOR_ID_MF624) {
                        continue;
                }
 
                /* loop through cards supported by this driver */
-               for(index = 0; index < N_BOARDS ; index++)
+               for(index = 0; index < N_BOARDS; index++)
                {
                        if(mf624_boards[index].device_id != pcidev->device) {
                                continue;
@@ -231,10 +229,7 @@ static int mf624_attach(struct comedi_device *dev, struct comedi_devconfig *it)
                        goto found;
                }
        }
-#ifdef EXTDEBUG
-       printk("comedi%d: mf624: No supported Humusoft card \
-                       found on requested position\n", dev->minor);
-#endif
+       
        comedi_error(dev, "No supported Humusoft card found on requested position\n");
        return -EIO;
 
@@ -242,19 +237,14 @@ found:
        printk("comedi%d: mf624: Found %s on bus %i, slot %i\n", dev->minor, 
                mf624_boards[index].name, pcidev->bus->number, PCI_SLOT(pcidev->devfn));
 
-       /* Enable PCI device and reserve I/O ports. */
+       /* Enable PCI device and reserve memory. */
        if(pci_enable_device(pcidev)) {
-#ifdef EXTDEBUG
-               printk("comedi%d: mf624: Failed to enable PCI device\n", dev->minor);
-#endif
                comedi_error(dev, "Failed to enable PCI device\n");
                return -EIO;
        }
+       
        if(pci_request_regions(pcidev, "mf624")) {
-#ifdef EXTDEBUG
-               printk("comedi%d: mf624: I/O port conflict\n", dev->minor);
-#endif
-               comedi_error(dev, "I/O port conflict\n");
+               comedi_error(dev, "Card's IO ports allready in use\n");
                return -EIO;
        }
 
@@ -344,7 +334,7 @@ found:
        }
 
        //printk("comedi%d: mf624: Board initialized\n", dev->minor);
-       return 1;
+       return 0;
 }