Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8829042ybi; Tue, 23 Jul 2019 16:11:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqykk7k7ghF2147PiRNBK4iN2Vwdw/R7gsi/OPXVspKmOb46hoA57Ox6dDgDwf5lyE0PnyOy X-Received: by 2002:a17:90a:2767:: with SMTP id o94mr81709899pje.25.1563923514326; Tue, 23 Jul 2019 16:11:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563923514; cv=none; d=google.com; s=arc-20160816; b=dveqTjRxWuX00nP5PbAhJO/emP8cacHYnQ6J8W0Zh4TZ/x3HJvdVXat0rkxluaJH3W vaNUtjkixW97BTKvu5mKpVovEE5ln6PYxsX56ctD2Qe+ubD099hYe1SE9MTnguwidKnW xgvFZmbjM/g7UTFj/WMmvO9+xrJzsYYcTDcjY05Jmk23a2RUwfX7wNw3tU0dCH1DtKMJ yCmnlzWPUG8uUMzqllC5nkkizgh4iMndKMtkMQsHM8XRMI1S1DCy1EHY2eUqGhTh7KNp IoKFWIULbOrUya4xlO7gqyW4tQZRbPLFQrm4KSQ5+X8yeId+ss0h8lKwg5pTU38mdFAR hXZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=KQTE/ixRUrNiBtj/aCpsC+f5UpJn3iQqRlhswTO8qG0=; b=RIscHgaatPwCMe57r2g5yGAsG9x6kngOhVo+QbpNSpbepmMQCxRG1upN5rH+v7dF/q 0aF/Q+Dh/jZnjHiBvzYLCI1p5gmaRTn051LA8u93wnEEQZzfBBm3cwLHnc909Q/epHYj nrlpS+fddBiSKek33Y5UtXIjHGgkBPxPUDjlKhVvUBVfQNykdsPo+CY2Fg6mAb52cVY/ Y8+FEX6GzPa+gFmHkjgcIhLUuGOI5vUSvxd4JPKdnzT8HlUMqoZ6zxwptwvkwgDWESCC Q4KMObeGo+bro+++61StPSvIw5RqVAfQnF3fgnILZxc1Y3NfvH4CaRhC3xLpYMpHb+Oy t5Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=RZGc6b++; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a17si15415560pff.195.2019.07.23.16.11.38; Tue, 23 Jul 2019 16:11:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=RZGc6b++; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732102AbfGWMqd (ORCPT + 99 others); Tue, 23 Jul 2019 08:46:33 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:34476 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727724AbfGWMqd (ORCPT ); Tue, 23 Jul 2019 08:46:33 -0400 Received: by mail-pl1-f196.google.com with SMTP id i2so20598449plt.1 for ; Tue, 23 Jul 2019 05:46:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KQTE/ixRUrNiBtj/aCpsC+f5UpJn3iQqRlhswTO8qG0=; b=RZGc6b++3eT519FJQCYX0Qiv89Cz3sJEGeYm1DTXyPOgKYWbnjOyLO2NbiTqowj+vz 6T4+VwCOCOU8IzCc16KkHaAizNB3t8mNaTBNRcUI72Q3gxQvB1U5sSGGc+/nNYADfSnR DZPV4bJCsxKQDqO+d+ksBbWMz9LdgxrkMGDEhTRdvzGA5eIdYupgOLj5ENsKfjbCTLB2 N4PH4wn7FyLmygPFa7gYSTMZ9dGoszoVmYHgAiC+8LRBneMj8FZRbM86GQuERQnSZ+L2 SWYNlZN5gW5+JXk7jU8XhWiGiIuyv9H4QwC9I4+vEyUpGMDO9ESpUK6zHI4PGdVkJqkf P2jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KQTE/ixRUrNiBtj/aCpsC+f5UpJn3iQqRlhswTO8qG0=; b=c68E7dkikFPJKzk1F+mWLApaQWlLrboxfY11X5VdzT5UcYuFw4Mmq0T3Y3WSx3Bmmi qTq6yGORqqYszK0xrqwV4VNeoXvDKwliQ1B68QkCJU4gXW492dsK9xKqBcpT5wtqOQU2 JLy86mz5la2x/Lww7pll9UprnNfaC3oJdlZZIa3X6GcCDqSkLlj4M3e6HvIDbfjNoJjC mjK5e6SWO83PK5e8w3K2u/oJ5eJKXNdz8n81vZQhO7vsrnsReftAKoOBe8MCpvpNrZV8 r6kLUEM/NXB3jqUoeAQKUeDyYE7bLtGHCPDqCLBB0qHb+TrcfgsMjYLE/yRbboLYPrW4 lOsA== X-Gm-Message-State: APjAAAV7xn3scKWWA7Qd1WaamxQ1Rw6w3M338T50qZlWqS1Z95+yj7s2 TYcrLI97GnK80WEM+tvJFO4= X-Received: by 2002:a17:902:aa41:: with SMTP id c1mr79846178plr.201.1563885992294; Tue, 23 Jul 2019 05:46:32 -0700 (PDT) Received: from suzukaze.ipads-lab.se.sjtu.edu.cn ([89.31.126.54]) by smtp.gmail.com with ESMTPSA id c69sm53818955pje.6.2019.07.23.05.46.30 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 23 Jul 2019 05:46:31 -0700 (PDT) From: Chuhong Yuan Cc: Tomas Winkler , Arnd Bergmann , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Chuhong Yuan Subject: [PATCH v2] mei: Use dev_get_drvdata where possible Date: Tue, 23 Jul 2019 20:46:27 +0800 Message-Id: <20190723124627.24671-1-hslester96@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of using to_pci_dev + pci_get_drvdata, use dev_get_drvdata to make code simpler. Signed-off-by: Chuhong Yuan --- Changes in v2: - Split v1 into different subsystems drivers/misc/mei/pci-me.c | 19 ++++++++----------- drivers/misc/mei/pci-txe.c | 19 ++++++++----------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c index 7a2b3545a7f9..6c7d54ab9bc5 100644 --- a/drivers/misc/mei/pci-me.c +++ b/drivers/misc/mei/pci-me.c @@ -378,12 +378,11 @@ static int mei_me_pci_resume(struct device *device) #ifdef CONFIG_PM static int mei_me_pm_runtime_idle(struct device *device) { - struct pci_dev *pdev = to_pci_dev(device); 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) return -ENODEV; if (mei_write_is_idle(dev)) @@ -394,13 +393,12 @@ static int mei_me_pm_runtime_idle(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; 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) return -ENODEV; @@ -413,7 +411,7 @@ static int mei_me_pm_runtime_suspend(struct device *device) 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) schedule_work(&dev->reset_work); @@ -423,13 +421,12 @@ static int mei_me_pm_runtime_suspend(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; 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) return -ENODEV; @@ -439,7 +436,7 @@ static int mei_me_pm_runtime_resume(struct device *device) 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) schedule_work(&dev->reset_work); diff --git a/drivers/misc/mei/pci-txe.c b/drivers/misc/mei/pci-txe.c index 2e37fc2e0fa8..f1c16a587495 100644 --- a/drivers/misc/mei/pci-txe.c +++ b/drivers/misc/mei/pci-txe.c @@ -276,12 +276,11 @@ static int mei_txe_pci_resume(struct device *device) #ifdef CONFIG_PM static int mei_txe_pm_runtime_idle(struct device *device) { - struct pci_dev *pdev = to_pci_dev(device); 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) return -ENODEV; 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) { - struct pci_dev *pdev = to_pci_dev(device); struct mei_device *dev; 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) return -ENODEV; @@ -310,7 +308,7 @@ static int mei_txe_pm_runtime_suspend(struct device *device) /* 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); @@ -322,13 +320,12 @@ static int mei_txe_pm_runtime_suspend(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; 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) return -ENODEV; @@ -340,7 +337,7 @@ static int mei_txe_pm_runtime_resume(struct device *device) 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) schedule_work(&dev->reset_work); -- 2.20.1