mei: push all standard settings into mei_device_init
authorTomas Winkler <tomas.winkler@intel.com>
Mon, 29 Sep 2014 13:31:41 +0000 (16:31 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 29 Sep 2014 15:56:01 +0000 (11:56 -0400)
Setting of hw_ops and device has should be in
mei_device_init.
We add reference to the parent device and remove
pci dependent cfg

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/mei/hw-me.c
drivers/misc/mei/hw-txe.c
drivers/misc/mei/init.c
drivers/misc/mei/mei_dev.h

index 56a9caa2e606935792207f22c4d19e74a26b6159..df42b6f6e7ca0697c4437bf2d3aa69fe058361de 100644 (file)
@@ -824,10 +824,8 @@ struct mei_device *mei_me_dev_init(struct pci_dev *pdev,
        if (!dev)
                return NULL;
 
-       mei_device_init(dev, cfg);
-
-       dev->ops = &mei_me_hw_ops;
-
+       mei_device_init(dev, &pdev->dev, &mei_me_hw_ops);
+       dev->cfg  = cfg;
        dev->pdev = pdev;
        return dev;
 }
index 1855b3b1ab21291aaef660a6f693fbd596e69689..fc1a51f818d0f389f0368d292065ccbd89f9ae28 100644 (file)
@@ -1123,14 +1123,13 @@ struct mei_device *mei_txe_dev_init(struct pci_dev *pdev,
        if (!dev)
                return NULL;
 
-       mei_device_init(dev, cfg);
+       mei_device_init(dev, &pdev->dev, &mei_txe_hw_ops);
 
        hw = to_txe_hw(dev);
 
        init_waitqueue_head(&hw->wait_aliveness_resp);
 
-       dev->ops = &mei_txe_hw_ops;
-
+       dev->cfg  = cfg;
        dev->pdev = pdev;
        return dev;
 }
index 5c41f5860c89688a9485b8bfab84c5bbae0ca075..ac659768e2b51cd3eab2eba4eb9b556fee8ceba7 100644 (file)
@@ -365,7 +365,16 @@ int mei_fw_status(struct mei_device *dev, struct mei_fw_status *fw_status)
 }
 EXPORT_SYMBOL_GPL(mei_fw_status);
 
-void mei_device_init(struct mei_device *dev, const struct mei_cfg *cfg)
+/**
+ * mei_device_init  -- initialize mei_device structure
+ *
+ * @dev: the mei device
+ * @device: the device structure
+ * @hw_ops: hw operations
+ */
+void mei_device_init(struct mei_device *dev,
+                    struct device *device,
+                    const struct mei_hw_ops *hw_ops)
 {
        /* setup our list array */
        INIT_LIST_HEAD(&dev->file_list);
@@ -404,7 +413,8 @@ void mei_device_init(struct mei_device *dev, const struct mei_cfg *cfg)
        bitmap_set(dev->host_clients_map, 0, 1);
 
        dev->pg_event = MEI_PG_EVENT_IDLE;
-       dev->cfg      = cfg;
+       dev->ops      = hw_ops;
+       dev->dev      = device;
 }
 EXPORT_SYMBOL_GPL(mei_device_init);
 
index be7b14766cfad98a4f1e39f23e4ee636f14c5066..7051430232556fd14035a6cc7594b58382fbabf3 100644 (file)
@@ -399,6 +399,7 @@ struct mei_cfg {
  * struct mei_device -  MEI private device struct
 
  * @pdev - pointer to pci device struct
+ * @dev  - device on a bus
  * @cdev - character device
  * @minor - minor number allocated for device
  *
@@ -417,6 +418,7 @@ struct mei_cfg {
  */
 struct mei_device {
        struct pci_dev *pdev;   /* pointer to pci device struct */
+       struct device *dev;
        struct cdev cdev;
        int minor;
 
@@ -560,7 +562,9 @@ static inline u32 mei_slots2data(int slots)
 /*
  * mei init function prototypes
  */
-void mei_device_init(struct mei_device *dev, const struct mei_cfg *cfg);
+void mei_device_init(struct mei_device *dev,
+                    struct device *device,
+                    const struct mei_hw_ops *hw_ops);
 int mei_reset(struct mei_device *dev);
 int mei_start(struct mei_device *dev);
 int mei_restart(struct mei_device *dev);