Merge to kernel-2.6.20-1.2949.fc6.vs2.2.0.1
[linux-2.6.git] / drivers / w1 / masters / matrox_w1.c
similarity index 91%
rename from drivers/w1/matrox_w1.c
rename to drivers/w1/masters/matrox_w1.c
index 0b03f8f..6f9d880 100644 (file)
@@ -19,8 +19,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
-#include <asm/atomic.h>
 #include <asm/types.h>
+#include <asm/atomic.h>
 #include <asm/io.h>
 
 #include <linux/delay.h>
@@ -35,9 +35,9 @@
 #include <linux/pci.h>
 #include <linux/timer.h>
 
-#include "w1.h"
-#include "w1_int.h"
-#include "w1_log.h"
+#include "../w1.h"
+#include "../w1_int.h"
+#include "../w1_log.h"
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>");
@@ -90,15 +90,15 @@ struct matrox_device
        struct w1_bus_master *bus_master;
 };
 
-static u8 matrox_w1_read_ddc_bit(unsigned long);
-static void matrox_w1_write_ddc_bit(unsigned long, u8);
+static u8 matrox_w1_read_ddc_bit(void *);
+static void matrox_w1_write_ddc_bit(void *, u8);
 
 /*
  * These functions read and write DDC Data bit.
  *
  * Using tristate pins, since i can't find any open-drain pin in whole motherboard.
  * Unfortunately we can't connect to Intel's 82801xx IO controller
- * since we don't know motherboard schema, wich has pretty unused(may be not) GPIO.
+ * since we don't know motherboard schema, which has pretty unused(may be not) GPIO.
  *
  * I've heard that PIIX also has open drain pin.
  *
@@ -122,10 +122,10 @@ static __inline__ void matrox_w1_write_reg(struct matrox_device *dev, u8 reg, u8
        wmb();
 }
 
-static void matrox_w1_write_ddc_bit(unsigned long data, u8 bit)
+static void matrox_w1_write_ddc_bit(void *data, u8 bit)
 {
        u8 ret;
-       struct matrox_device *dev = (struct matrox_device *) data;
+       struct matrox_device *dev = data;
 
        if (bit)
                bit = 0;
@@ -137,10 +137,10 @@ static void matrox_w1_write_ddc_bit(unsigned long data, u8 bit)
        matrox_w1_write_reg(dev, MATROX_GET_DATA, 0x00);
 }
 
-static u8 matrox_w1_read_ddc_bit(unsigned long data)
+static u8 matrox_w1_read_ddc_bit(void *data)
 {
        u8 ret;
-       struct matrox_device *dev = (struct matrox_device *) data;
+       struct matrox_device *dev = data;
 
        ret = matrox_w1_read_reg(dev, MATROX_GET_DATA);
 
@@ -198,7 +198,7 @@ static int __devinit matrox_w1_probe(struct pci_dev *pdev, const struct pci_devi
 
        matrox_w1_hw_init(dev);
 
-       dev->bus_master->data = (unsigned long) dev;
+       dev->bus_master->data = dev;
        dev->bus_master->read_bit = &matrox_w1_read_ddc_bit;
        dev->bus_master->write_bit = &matrox_w1_write_ddc_bit;
 
@@ -215,6 +215,8 @@ static int __devinit matrox_w1_probe(struct pci_dev *pdev, const struct pci_devi
        return 0;
 
 err_out_free_device:
+       if (dev->virt_addr)
+               iounmap(dev->virt_addr);
        kfree(dev);
 
        return err;