mei: Use dev_get_drvdata where possible
Instead of using to_pci_dev + pci_get_drvdata, use dev_get_drvdata to make code simpler. Signed-off-by: Chuhong Yuan <hslester96@gmail.com> Link: https://lore.kernel.org/r/20190723124627.24671-1-hslester96@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Родитель
7508037045
Коммит
ab81f3f386
|
@ -381,12 +381,11 @@ static int mei_me_pci_resume(struct device *device)
|
||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM
|
||||||
static int mei_me_pm_runtime_idle(struct device *device)
|
static int mei_me_pm_runtime_idle(struct device *device)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = to_pci_dev(device);
|
|
||||||
struct mei_device *dev;
|
struct mei_device *dev;
|
||||||
|
|
||||||
dev_dbg(&pdev->dev, "rpm: me: runtime_idle\n");
|
dev_dbg(device, "rpm: me: runtime_idle\n");
|
||||||
|
|
||||||
dev = pci_get_drvdata(pdev);
|
dev = dev_get_drvdata(device);
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
if (mei_write_is_idle(dev))
|
if (mei_write_is_idle(dev))
|
||||||
|
@ -397,13 +396,12 @@ static int mei_me_pm_runtime_idle(struct device *device)
|
||||||
|
|
||||||
static int mei_me_pm_runtime_suspend(struct device *device)
|
static int mei_me_pm_runtime_suspend(struct device *device)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = to_pci_dev(device);
|
|
||||||
struct mei_device *dev;
|
struct mei_device *dev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
dev_dbg(&pdev->dev, "rpm: me: runtime suspend\n");
|
dev_dbg(device, "rpm: me: runtime suspend\n");
|
||||||
|
|
||||||
dev = pci_get_drvdata(pdev);
|
dev = dev_get_drvdata(device);
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
|
@ -416,7 +414,7 @@ static int mei_me_pm_runtime_suspend(struct device *device)
|
||||||
|
|
||||||
mutex_unlock(&dev->device_lock);
|
mutex_unlock(&dev->device_lock);
|
||||||
|
|
||||||
dev_dbg(&pdev->dev, "rpm: me: runtime suspend ret=%d\n", ret);
|
dev_dbg(device, "rpm: me: runtime suspend ret=%d\n", ret);
|
||||||
|
|
||||||
if (ret && ret != -EAGAIN)
|
if (ret && ret != -EAGAIN)
|
||||||
schedule_work(&dev->reset_work);
|
schedule_work(&dev->reset_work);
|
||||||
|
@ -426,13 +424,12 @@ static int mei_me_pm_runtime_suspend(struct device *device)
|
||||||
|
|
||||||
static int mei_me_pm_runtime_resume(struct device *device)
|
static int mei_me_pm_runtime_resume(struct device *device)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = to_pci_dev(device);
|
|
||||||
struct mei_device *dev;
|
struct mei_device *dev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
dev_dbg(&pdev->dev, "rpm: me: runtime resume\n");
|
dev_dbg(device, "rpm: me: runtime resume\n");
|
||||||
|
|
||||||
dev = pci_get_drvdata(pdev);
|
dev = dev_get_drvdata(device);
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
|
@ -442,7 +439,7 @@ static int mei_me_pm_runtime_resume(struct device *device)
|
||||||
|
|
||||||
mutex_unlock(&dev->device_lock);
|
mutex_unlock(&dev->device_lock);
|
||||||
|
|
||||||
dev_dbg(&pdev->dev, "rpm: me: runtime resume ret = %d\n", ret);
|
dev_dbg(device, "rpm: me: runtime resume ret = %d\n", ret);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
schedule_work(&dev->reset_work);
|
schedule_work(&dev->reset_work);
|
||||||
|
|
|
@ -276,12 +276,11 @@ static int mei_txe_pci_resume(struct device *device)
|
||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM
|
||||||
static int mei_txe_pm_runtime_idle(struct device *device)
|
static int mei_txe_pm_runtime_idle(struct device *device)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = to_pci_dev(device);
|
|
||||||
struct mei_device *dev;
|
struct mei_device *dev;
|
||||||
|
|
||||||
dev_dbg(&pdev->dev, "rpm: txe: runtime_idle\n");
|
dev_dbg(device, "rpm: txe: runtime_idle\n");
|
||||||
|
|
||||||
dev = pci_get_drvdata(pdev);
|
dev = dev_get_drvdata(device);
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
if (mei_write_is_idle(dev))
|
if (mei_write_is_idle(dev))
|
||||||
|
@ -291,13 +290,12 @@ static int mei_txe_pm_runtime_idle(struct device *device)
|
||||||
}
|
}
|
||||||
static int mei_txe_pm_runtime_suspend(struct device *device)
|
static int mei_txe_pm_runtime_suspend(struct device *device)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = to_pci_dev(device);
|
|
||||||
struct mei_device *dev;
|
struct mei_device *dev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
dev_dbg(&pdev->dev, "rpm: txe: runtime suspend\n");
|
dev_dbg(device, "rpm: txe: runtime suspend\n");
|
||||||
|
|
||||||
dev = pci_get_drvdata(pdev);
|
dev = dev_get_drvdata(device);
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
|
@ -310,7 +308,7 @@ static int mei_txe_pm_runtime_suspend(struct device *device)
|
||||||
|
|
||||||
/* keep irq on we are staying in D0 */
|
/* keep irq on we are staying in D0 */
|
||||||
|
|
||||||
dev_dbg(&pdev->dev, "rpm: txe: runtime suspend ret=%d\n", ret);
|
dev_dbg(device, "rpm: txe: runtime suspend ret=%d\n", ret);
|
||||||
|
|
||||||
mutex_unlock(&dev->device_lock);
|
mutex_unlock(&dev->device_lock);
|
||||||
|
|
||||||
|
@ -322,13 +320,12 @@ static int mei_txe_pm_runtime_suspend(struct device *device)
|
||||||
|
|
||||||
static int mei_txe_pm_runtime_resume(struct device *device)
|
static int mei_txe_pm_runtime_resume(struct device *device)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = to_pci_dev(device);
|
|
||||||
struct mei_device *dev;
|
struct mei_device *dev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
dev_dbg(&pdev->dev, "rpm: txe: runtime resume\n");
|
dev_dbg(device, "rpm: txe: runtime resume\n");
|
||||||
|
|
||||||
dev = pci_get_drvdata(pdev);
|
dev = dev_get_drvdata(device);
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
|
@ -340,7 +337,7 @@ static int mei_txe_pm_runtime_resume(struct device *device)
|
||||||
|
|
||||||
mutex_unlock(&dev->device_lock);
|
mutex_unlock(&dev->device_lock);
|
||||||
|
|
||||||
dev_dbg(&pdev->dev, "rpm: txe: runtime resume ret = %d\n", ret);
|
dev_dbg(device, "rpm: txe: runtime resume ret = %d\n", ret);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
schedule_work(&dev->reset_work);
|
schedule_work(&dev->reset_work);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче