Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9165614ybi; Tue, 23 Jul 2019 23:09:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqwiLgjlWtPBMxt77By4V2tXmB/9tELflsxA2doTwXE0y4NNpvKmcvPPOCkMcYb17WZE/Lfd X-Received: by 2002:a17:902:2bc5:: with SMTP id l63mr86850166plb.30.1563948550135; Tue, 23 Jul 2019 23:09:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563948550; cv=none; d=google.com; s=arc-20160816; b=S6PfsWKHJmk6+5qAKzXu9tP3uWJPdmZ8XgVuZ7r95CdAReBNdve7j1gFVslzq94coR 407EiXCyysOgqubiNzm3BbG7o2y6q3YsC4zAAtHUOYQjj7P7PZXr7F3aGpt0kmfzdQx8 IcVTxKQvmhP8CJzquCfEAePoHppRJ86pI/++HpzylM63Sx94xX8GSSAunbsWVIfTVnhG EniFcC0rn7DBU1xzNBnSzKMDu9mnHMD4e3k0dX7HIpqSQZXaUTIr/4JU0vKvuGu4x2x2 g7txhAWUPCyP+AanjKKwKnRDg/0WEo1dWBkwk4s80srATC/vis12S66naOZR6BAKI2mu hrHw== 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=3uxz/F8fAbkCDFD+nINfvnMjV4IUPu+90Frw3nw53wk=; b=0qv2NF8sZQ0xCDtnp61ggOn49n66LMfzDtIzbg7l2twEwmwGMXGl4binZTM/m2uiYl 2/Md9L4DBow4FEF1iwG07pRglUKqZY1/aYKhSyIlWT2D4ce1DtiJfswA72sNIYAuj9B+ A3RVwSuuczwjuhh6pC0wpu7RD7uaS+ocXeVdhIbioa88nUBcyOy1THxLfjTAClXGw/B0 5EAN704GN6A05Mgt6qW8l6Zq8h6z9CpZ3bLERdL2ODgoQNevmEt8sDd6csCoVICTgDXe 8p3Dknpo0j+O9gsT4JUXfGH6QtO1vL1j39996S1SdeQv4y9/S5qX1E5AZkQJmG5fZJsW OVRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="sW/w6n2h"; 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 31si14207569plk.342.2019.07.23.23.08.55; Tue, 23 Jul 2019 23:09:10 -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="sW/w6n2h"; 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 S1726600AbfGXGGc (ORCPT + 99 others); Wed, 24 Jul 2019 02:06:32 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:46766 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725900AbfGXGGc (ORCPT ); Wed, 24 Jul 2019 02:06:32 -0400 Received: by mail-pl1-f195.google.com with SMTP id c2so21534207plz.13; Tue, 23 Jul 2019 23:06:31 -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=3uxz/F8fAbkCDFD+nINfvnMjV4IUPu+90Frw3nw53wk=; b=sW/w6n2hnTKsqa3uenaBVxUGwEp2jhw3CwcJBYiFkIL1xoT2fQZnygvw28FKspmxYx Nz4d0TPzyoi2KUp1tHRWtd8Z3JjGfq3MmVMQQ7HjzvoGxFAApSIWhMswa0/bJwIQhWCU WEsall8mS76zHwYsaC73yjVP/7V1GUBKLx6m0MpT4ESx1rpO4dTL/Q0011rP9pWoz5Om 6vk8whk+6SuNxXI60qIQwPCKTe4BXmWOYJZn05rTsRHvGCoPSm1TZ0s0lRoqisi/QbbK lPGwfY25QtkfmLDXBnUFPL4f0HESKSnGuEd1bEguQYY/oqHwdOQy+rJHoOqbGrbOS3x/ V5Bw== 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=3uxz/F8fAbkCDFD+nINfvnMjV4IUPu+90Frw3nw53wk=; b=rz1PgWcVbUK6zs7e3p4Twz+pU51IRW4NtmUH+4aUu872BTfd//GE7TL4WMMNNBxB9B Am6HdbmnygflyK06wtSvmPE1DbkCneAeBgBZ9JbSJ0BuynCSXVr45BXeg0inp2uOYq2C jgTHZg4ViYacW5B3vOGSsoY4qgARvWU61+4Lst6VUgIEF9B2guU3iJvrY/oYsTBLInId SMk3196lfac5VpxsGLs5Jo2cevdJFLrKXush+0bMjFCvLz7wm6N30+SXnLN/IG3SntvE Kg8UYjvzGn5VKMIN84E++wDbGaut+Pn4UFsNw5SjKRNMINckai0N9ySBZsIgmIW4p6W1 2jdQ== X-Gm-Message-State: APjAAAWcSjVCPFCIupJ6JqstlEDVY5P64qaRMda/AJ6VPgJq0sPhpHRY oG3EarmziPoFDyPwY7a1CLQ= X-Received: by 2002:a17:902:2d01:: with SMTP id o1mr86095743plb.105.1563948391700; Tue, 23 Jul 2019 23:06:31 -0700 (PDT) Received: from suzukaze.ipads-lab.se.sjtu.edu.cn ([89.31.126.54]) by smtp.gmail.com with ESMTPSA id 64sm46660992pfe.128.2019.07.23.23.06.29 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 23 Jul 2019 23:06:31 -0700 (PDT) From: Chuhong Yuan Cc: Jeff Kirsher , "David S . Miller" , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Chuhong Yuan Subject: [PATCH net-next v2 6/8] i40e: Use dev_get_drvdata Date: Wed, 24 Jul 2019 14:06:26 +0800 Message-Id: <20190724060626.24226-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: - Change pci_set_drvdata to dev_set_drvdata to keep consistency. drivers/net/ethernet/intel/i40e/i40e_main.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 9ebbe3da61bb..a83198a0ba51 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -14938,7 +14938,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (is_valid_ether_addr(hw->mac.port_addr)) pf->hw_features |= I40E_HW_PORT_ID_VALID; - pci_set_drvdata(pdev, pf); + dev_set_drvdata(&pdev->dev, pf); pci_save_state(pdev); dev_info(&pdev->dev, @@ -15605,8 +15605,7 @@ static void i40e_shutdown(struct pci_dev *pdev) **/ static int __maybe_unused i40e_suspend(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - struct i40e_pf *pf = pci_get_drvdata(pdev); + struct i40e_pf *pf = dev_get_drvdata(dev); struct i40e_hw *hw = &pf->hw; /* If we're already suspended, then there is nothing to do */ @@ -15656,8 +15655,7 @@ static int __maybe_unused i40e_suspend(struct device *dev) **/ static int __maybe_unused i40e_resume(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - struct i40e_pf *pf = pci_get_drvdata(pdev); + struct i40e_pf *pf = dev_get_drvdata(dev); int err; /* If we're not suspended, then there is nothing to do */ @@ -15674,7 +15672,7 @@ static int __maybe_unused i40e_resume(struct device *dev) */ err = i40e_restore_interrupt_scheme(pf); if (err) { - dev_err(&pdev->dev, "Cannot restore interrupt scheme: %d\n", + dev_err(dev, "Cannot restore interrupt scheme: %d\n", err); } -- 2.20.1