Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8828948ybi; Tue, 23 Jul 2019 16:11:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqw9AS5zUNKx3e03O/fnIemN+FLnH36u796XIyii0AG0yMfARwqwBETtOkDbo7arx4Ho/gx/ X-Received: by 2002:aa7:9ab5:: with SMTP id x21mr8045283pfi.139.1563923506977; Tue, 23 Jul 2019 16:11:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563923506; cv=none; d=google.com; s=arc-20160816; b=f/fLICS6gbmZHQFTag4FomXU1HeFpTSze5O8QkO9k+Y+BxRqWFrCDkaMI+o7GuhZc+ xSx6JJuLL80OCP0lqh3xzFDLhX1ThL3JrNG6oo48TKxCe5M1FWZtBQY15qCYohybyBxx MlAcL6oTaxHwWnmHnO1pXyZC03Bvrq+5RsKn+JkPoDtB5hUTs/CAat3t9YmrssfhILNr 4VLplWNLsCivI2tyC3pUiaOG3tW4osM3Nb5/fFBrwn3UpsjlKcXvJbhuic+zgNrrWNd4 /Nmluczv5kgQYeE0caKl4kTAat7xV2/hzKt8kBpBp8fXgoNlqWu0oGXjp0JXvZgfG5WA K3tA== 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=AqD68kCeUjLnMnjMcDvk6An8PGKZbr6I3VjMH7CQavU=; b=Hp/dSr9WM/RNEkb/T3zEO5z39PaJ1Zt4WsJlN7UrAjRGKWD1ltD7kv5hA4Jb07mHss AhW2zlh6GkJVJs9yLWiSfsCKnRQGyEOzWcSRyWTiZsLtVc7E5df55BimMWtqWnl7QgHl xkttKNOCuMrSk8kNdC1w3xxJd0gcuPCDnQR5pR1XJJs3tlmOrKVmC3xeV4EOVDWx8eln e5O0W4tMIdY56woYb16xytY4dbyV/BUPDgg6Vi5+kCGM1Dejun4FV9YKUC/0HonqGwWk Ee2oCFzeFUU+A6cXOck8mzGIJDjbJWQppUnibt33fWJvmdlv/nZnzOjNbPKLz9TzprAL FlMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ioqX3pf2; 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 t17si14539732pfe.269.2019.07.23.16.11.31; Tue, 23 Jul 2019 16:11:46 -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=ioqX3pf2; 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 S1731689AbfGWMqO (ORCPT + 99 others); Tue, 23 Jul 2019 08:46:14 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:39301 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727724AbfGWMqO (ORCPT ); Tue, 23 Jul 2019 08:46:14 -0400 Received: by mail-pl1-f193.google.com with SMTP id b7so20611569pls.6 for ; Tue, 23 Jul 2019 05:46:14 -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=AqD68kCeUjLnMnjMcDvk6An8PGKZbr6I3VjMH7CQavU=; b=ioqX3pf2AXx4+ruf7u0grl5/sg5w01GEnvz5hinkDg93S923RNmBKgqlFYtXXDbB0i uShMa1QoNj2Rl0KlhwyK5XFKu6fvKFmwl5fS0XaeNV4nQZItdxtC9GsPtab/yDZ0U5sE bKaD1L0QdfUxUJMOrGkMIfgCGKR7dhfV/LBk61jEs6lFP+5NVd+6slpb5yuyf0Zu/JZl r5og3oTOYf+T53l2JFTtXtgYeBN4giGTqKasFBQmX+/FwwQm2+2SQkOstqF8Db0eWx7V IjwRFlHQu8TgY6oKO+lvCP57Re3pX/zCPFp1jOhVZyFSwfc4Ilq5lsZz6Yyyf56ZBWx1 6xhQ== 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=AqD68kCeUjLnMnjMcDvk6An8PGKZbr6I3VjMH7CQavU=; b=i/MD1AER0TZw9b/9KK+W1YCjk0N2GerZIsqGtRsDYQMDy1OSsEQfdCsMIiD5iIw8Ek Ki1K0dAc9ldXKX8f3V/EoC+56F8LgfbwW5gHXu1xg0diZZm/IbICCs0vuvQ+mrjQCkSk 4Dio+6acAq92OuMkWpSuScX1pq0eSm/XjcK951JgfKTVhRj/Evf739hT4TOpNxB/PlaE 5pfWyENsmInDD6F711tAkaft32Y1Gi7+Ci5rnQdkPC5tqH16xWRNrGb2c8HF8iijZ8gV EExkQDOIXc0OsCGC8jPi7U4MBaeukfLEeyyU8P/mdeiFnIH9Owx+nW07cbTuzKvYFsHz VqOg== X-Gm-Message-State: APjAAAV677LRWjc3okSoCswyPZjtchrDJCd4V9hYAV1wZ08qCv7ElNa4 AmrTKCrCYibAC5JwpQ7MW5Q= X-Received: by 2002:a17:902:bd06:: with SMTP id p6mr82641670pls.189.1563885973897; Tue, 23 Jul 2019 05:46:13 -0700 (PDT) Received: from suzukaze.ipads-lab.se.sjtu.edu.cn ([89.31.126.54]) by smtp.gmail.com with ESMTPSA id l26sm31702686pgb.90.2019.07.23.05.46.11 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 23 Jul 2019 05:46:13 -0700 (PDT) From: Chuhong Yuan Cc: Oded Gabbay , Arnd Bergmann , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Chuhong Yuan Subject: [PATCH v2] habanalabs: Use dev_get_drvdata Date: Tue, 23 Jul 2019 20:46:08 +0800 Message-Id: <20190723124608.24617-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/habanalabs/habanalabs_drv.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/misc/habanalabs/habanalabs_drv.c b/drivers/misc/habanalabs/habanalabs_drv.c index 6f6dbe93f1df..678f61646ca9 100644 --- a/drivers/misc/habanalabs/habanalabs_drv.c +++ b/drivers/misc/habanalabs/habanalabs_drv.c @@ -295,8 +295,7 @@ void destroy_hdev(struct hl_device *hdev) static int hl_pmops_suspend(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - struct hl_device *hdev = pci_get_drvdata(pdev); + struct hl_device *hdev = dev_get_drvdata(dev); pr_debug("Going to suspend PCI device\n"); @@ -310,8 +309,7 @@ static int hl_pmops_suspend(struct device *dev) static int hl_pmops_resume(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - struct hl_device *hdev = pci_get_drvdata(pdev); + struct hl_device *hdev = dev_get_drvdata(dev); pr_debug("Going to resume PCI device\n"); -- 2.20.1