Merge tag 'topic/drm-fixes-2015-11-11' of git://anongit.freedesktop.org/drm-intel...
[firefly-linux-kernel-4.4.55.git] / drivers / i2c / busses / i2c-ismt.c
index 3cc20f35ae8af412028b2d664fbe1308cf54b0b4..7ba795b24e75d4d212972ddfa0675d582a9ef671 100644 (file)
@@ -67,7 +67,7 @@
 #include <linux/acpi.h>
 #include <linux/interrupt.h>
 
-#include <asm-generic/io-64-nonatomic-lo-hi.h>
+#include <linux/io-64-nonatomic-lo-hi.h>
 
 /* PCI Address Constants */
 #define SMBBAR         0
@@ -788,11 +788,8 @@ static int ismt_int_init(struct ismt_priv *priv)
 
        /* Try using MSI interrupts */
        err = pci_enable_msi(priv->pci_dev);
-       if (err) {
-               dev_warn(&priv->pci_dev->dev,
-                        "Unable to use MSI interrupts, falling back to legacy\n");
+       if (err)
                goto intx;
-       }
 
        err = devm_request_irq(&priv->pci_dev->dev,
                               priv->pci_dev->irq,
@@ -805,10 +802,13 @@ static int ismt_int_init(struct ismt_priv *priv)
                goto intx;
        }
 
-       goto done;
+       return 0;
 
        /* Try using legacy interrupts */
 intx:
+       dev_warn(&priv->pci_dev->dev,
+                "Unable to use MSI interrupts, falling back to legacy\n");
+
        err = devm_request_irq(&priv->pci_dev->dev,
                               priv->pci_dev->irq,
                               ismt_do_interrupt,
@@ -817,10 +817,9 @@ intx:
                               priv);
        if (err) {
                dev_err(&priv->pci_dev->dev, "no usable interrupts\n");
-               return -ENODEV;
+               return err;
        }
 
-done:
        return 0;
 }
 
@@ -843,17 +842,13 @@ ismt_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                return -ENOMEM;
 
        pci_set_drvdata(pdev, priv);
+
        i2c_set_adapdata(&priv->adapter, priv);
        priv->adapter.owner = THIS_MODULE;
-
        priv->adapter.class = I2C_CLASS_HWMON;
-
        priv->adapter.algo = &smbus_algorithm;
-
-       /* set up the sysfs linkage to our parent device */
        priv->adapter.dev.parent = &pdev->dev;
-
-       /* number of retries on lost arbitration */
+       ACPI_COMPANION_SET(&priv->adapter.dev, ACPI_COMPANION(&pdev->dev));
        priv->adapter.retries = ISMT_MAX_RETRIES;
 
        priv->pci_dev = pdev;