mei: initial extract of ME hw specifics from mei_device

This is initial step of move the ME hw specifics
out of mei_device structure into mei_me_hw

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c
index eaed398..27ac717 100644
--- a/drivers/misc/mei/pci-me.c
+++ b/drivers/misc/mei/pci-me.c
@@ -90,7 +90,6 @@
 
 static DEFINE_MUTEX(mei_mutex);
 
-
 /**
  * mei_quirk_probe - probe for devices that doesn't valid ME interface
  * @pdev: PCI device structure
@@ -120,10 +119,10 @@
  *
  * returns 0 on success, <0 on failure.
  */
-static int mei_probe(struct pci_dev *pdev,
-				const struct pci_device_id *ent)
+static int mei_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 	struct mei_device *dev;
+	struct mei_me_hw *hw;
 	int err;
 
 	mutex_lock(&mei_mutex);
@@ -152,14 +151,15 @@
 		goto disable_device;
 	}
 	/* allocates and initializes the mei dev structure */
-	dev = mei_device_init(pdev);
+	dev = mei_me_dev_init(pdev);
 	if (!dev) {
 		err = -ENOMEM;
 		goto release_regions;
 	}
+	hw = to_me_hw(dev);
 	/* mapping  IO device memory */
-	dev->mem_addr = pci_iomap(pdev, 0, 0);
-	if (!dev->mem_addr) {
+	hw->mem_addr = pci_iomap(pdev, 0, 0);
+	if (!hw->mem_addr) {
 		dev_err(&pdev->dev, "mapping I/O device memory failure.\n");
 		err = -ENOMEM;
 		goto free_device;
@@ -212,7 +212,7 @@
 	free_irq(pdev->irq, dev);
 disable_msi:
 	pci_disable_msi(pdev);
-	pci_iounmap(pdev, dev->mem_addr);
+	pci_iounmap(pdev, hw->mem_addr);
 free_device:
 	kfree(dev);
 release_regions:
@@ -236,6 +236,7 @@
 static void mei_remove(struct pci_dev *pdev)
 {
 	struct mei_device *dev;
+	struct mei_me_hw *hw;
 
 	if (mei_pdev != pdev)
 		return;
@@ -244,6 +245,8 @@
 	if (!dev)
 		return;
 
+	hw = to_me_hw(dev);
+
 	mutex_lock(&dev->device_lock);
 
 	cancel_delayed_work(&dev->timer_work);
@@ -289,8 +292,8 @@
 	pci_disable_msi(pdev);
 	pci_set_drvdata(pdev, NULL);
 
-	if (dev->mem_addr)
-		pci_iounmap(pdev, dev->mem_addr);
+	if (hw->mem_addr)
+		pci_iounmap(pdev, hw->mem_addr);
 
 	kfree(dev);