Commit 907b471c authored by Tomas Winkler's avatar Tomas Winkler Committed by Greg Kroah-Hartman

mei: me: mei_me_dev_init() use struct device instead of struct pci_dev.

It's enough to bind mei_device with associated 'struct device' instead
of actual 'struct pci_dev'. This is to allow working with mei devices
embedded within another pci device, usually via MFD framework,
where mei device is represented as a platform device.

Bump copyright year to 2019 on effected files.
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20191106223841.15802-2-tomas.winkler@intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7383092c
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
/* /*
* Copyright (c) 2003-2018, Intel Corporation. All rights reserved. * Copyright (c) 2003-2019, Intel Corporation. All rights reserved.
* Intel Management Engine Interface (Intel MEI) Linux driver * Intel Management Engine Interface (Intel MEI) Linux driver
*/ */
...@@ -1461,19 +1461,19 @@ const struct mei_cfg *mei_me_get_cfg(kernel_ulong_t idx) ...@@ -1461,19 +1461,19 @@ const struct mei_cfg *mei_me_get_cfg(kernel_ulong_t idx)
/** /**
* mei_me_dev_init - allocates and initializes the mei device structure * mei_me_dev_init - allocates and initializes the mei device structure
* *
* @pdev: The pci device structure * @parent: device associated with physical device (pci/platform)
* @cfg: per device generation config * @cfg: per device generation config
* *
* Return: The mei_device pointer on success, NULL on failure. * Return: The mei_device pointer on success, NULL on failure.
*/ */
struct mei_device *mei_me_dev_init(struct pci_dev *pdev, struct mei_device *mei_me_dev_init(struct device *parent,
const struct mei_cfg *cfg) const struct mei_cfg *cfg)
{ {
struct mei_device *dev; struct mei_device *dev;
struct mei_me_hw *hw; struct mei_me_hw *hw;
int i; int i;
dev = devm_kzalloc(&pdev->dev, sizeof(struct mei_device) + dev = devm_kzalloc(parent, sizeof(struct mei_device) +
sizeof(struct mei_me_hw), GFP_KERNEL); sizeof(struct mei_me_hw), GFP_KERNEL);
if (!dev) if (!dev)
return NULL; return NULL;
...@@ -1483,7 +1483,7 @@ struct mei_device *mei_me_dev_init(struct pci_dev *pdev, ...@@ -1483,7 +1483,7 @@ struct mei_device *mei_me_dev_init(struct pci_dev *pdev,
for (i = 0; i < DMA_DSCR_NUM; i++) for (i = 0; i < DMA_DSCR_NUM; i++)
dev->dr_dscr[i].size = cfg->dma_size[i]; dev->dr_dscr[i].size = cfg->dma_size[i];
mei_device_init(dev, &pdev->dev, &mei_me_hw_ops); mei_device_init(dev, parent, &mei_me_hw_ops);
hw->cfg = cfg; hw->cfg = cfg;
dev->fw_f_fw_ver_supported = cfg->fw_ver_supported; dev->fw_f_fw_ver_supported = cfg->fw_ver_supported;
......
/* SPDX-License-Identifier: GPL-2.0 */ /* SPDX-License-Identifier: GPL-2.0 */
/* /*
* Copyright (c) 2012-2018, Intel Corporation. All rights reserved. * Copyright (c) 2012-2019, Intel Corporation. All rights reserved.
* Intel Management Engine Interface (Intel MEI) Linux driver * Intel Management Engine Interface (Intel MEI) Linux driver
*/ */
...@@ -91,7 +91,7 @@ enum mei_cfg_idx { ...@@ -91,7 +91,7 @@ enum mei_cfg_idx {
const struct mei_cfg *mei_me_get_cfg(kernel_ulong_t idx); const struct mei_cfg *mei_me_get_cfg(kernel_ulong_t idx);
struct mei_device *mei_me_dev_init(struct pci_dev *pdev, struct mei_device *mei_me_dev_init(struct device *parent,
const struct mei_cfg *cfg); const struct mei_cfg *cfg);
int mei_me_pg_enter_sync(struct mei_device *dev); int mei_me_pg_enter_sync(struct mei_device *dev);
......
...@@ -192,7 +192,7 @@ static int mei_me_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -192,7 +192,7 @@ static int mei_me_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
} }
/* allocates and initializes the mei dev structure */ /* allocates and initializes the mei dev structure */
dev = mei_me_dev_init(pdev, cfg); dev = mei_me_dev_init(&pdev->dev, cfg);
if (!dev) { if (!dev) {
err = -ENOMEM; err = -ENOMEM;
goto end; goto end;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment