From patchwork Wed Jul 24 06:06:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuhong Yuan X-Patchwork-Id: 1136084 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=osuosl.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ZTKmSpvv"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45tlGR0Zrnz9s4Y for ; Wed, 24 Jul 2019 16:06:22 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 13C7B86661; Wed, 24 Jul 2019 06:06:20 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gaUgOUPcc8cG; Wed, 24 Jul 2019 06:06:19 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 39A4D86133; Wed, 24 Jul 2019 06:06:19 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id AFDFB1BF5A9 for ; Wed, 24 Jul 2019 06:06:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 8336986133 for ; Wed, 24 Jul 2019 06:06:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TeFnIvys9638 for ; Wed, 24 Jul 2019 06:06:14 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by whitealder.osuosl.org (Postfix) with ESMTPS id E54EA8610F for ; Wed, 24 Jul 2019 06:06:14 +0000 (UTC) Received: by mail-pl1-f194.google.com with SMTP id az7so21541928plb.5 for ; Tue, 23 Jul 2019 23:06: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=guFxv22S4JOArjEKN9Dxhy2TAljfranssf7R2KMuN5E=; b=ZTKmSpvvsEXCKpAARDgWNlQPMnESR+iob7CQxD1+ohydGxdFzikNctwCkFA2oVR7tl vhWkS87ZiFhQzjGAF6sIlX4Vvp74szDJbXg14WXjKIT8jdu5cXZaVfPFKD7KsG1jWtib E+YPjwVfnEDnPfRFPQngmzIEIJgm/+2pJxRfNI6VCeGXZPnjVo1xozXyxqzC1gYeTviK kRg1eKPKxK7VYfjBHtZIfyKWfQADzb2Uwn1esGUrWaBHyhLqehZ43IEW+ohqKhUegEcn jklne6LVA08suiBLtsqrFvUCwV+Ox9XtdBwZd1E1/OQtdTqKfav+6pRBV59ECgmrXaYR ctQQ== 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=guFxv22S4JOArjEKN9Dxhy2TAljfranssf7R2KMuN5E=; b=l9851zJp5g0HQ3hgMm/ITaeYUOlBQcctrX5r9KsQeW9CohrEUGik8lgGvoBxh7X1Fi vcWWNa2bsAI0JPIvWZwNphU8EGsjfdEBiP7/H71takiR3Pb1JWcnoInU4kOz6FC8eIeN bCY1FMnntY4F4CDq9ME7LVvP5GnIrKE/XGVrbGks67Z5elgHrnGQSe2TVmVF9OJR1XSu /k8fMIDtmQnsplCd5+rAETRkmR6/Ow+yubFpW5YY+07BA5UJ2bzBtdTy+QtSbkTQEnwh pAykK+JRdck6oVKvxapLucceLlGEl9bpd+k5X/0m+ArWKCxAZjegZ5nPJipKqhTnVF3p KiTQ== X-Gm-Message-State: APjAAAVb+0LPeTUoAGjX0M6zDmPR0oHqUCjl+JL9usD+Y79C7CHtpxLj /YBcDoCfuwC2k9F/R33P7Lg= X-Google-Smtp-Source: APXvYqy/1q7UpsiiVNicCAmywrdgkmPJes/B8K5Uqe0sjcw3wKWzW8+klY0U35P3+v9l1Eh16zs62w== X-Received: by 2002:a17:902:110b:: with SMTP id d11mr87862606pla.213.1563948374625; Tue, 23 Jul 2019 23:06:14 -0700 (PDT) Received: from suzukaze.ipads-lab.se.sjtu.edu.cn ([89.31.126.54]) by smtp.gmail.com with ESMTPSA id a3sm46434953pfo.49.2019.07.23.23.06.12 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 23 Jul 2019 23:06:14 -0700 (PDT) From: Chuhong Yuan To: Date: Wed, 24 Jul 2019 14:06:09 +0800 Message-Id: <20190724060609.24116-1-hslester96@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Intel-wired-lan] [PATCH net-next v2 4/8] e1000e: Use dev_get_drvdata where possible X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, Chuhong Yuan , linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, "David S . Miller" Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" 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/e1000e/netdev.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index e4baa13b3cda..ad203a2a64c4 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -6297,7 +6297,7 @@ static void e1000e_flush_lpic(struct pci_dev *pdev) static int e1000e_pm_freeze(struct device *dev) { - struct net_device *netdev = pci_get_drvdata(to_pci_dev(dev)); + struct net_device *netdev = dev_get_drvdata(dev); struct e1000_adapter *adapter = netdev_priv(netdev); netif_device_detach(netdev); @@ -6630,7 +6630,7 @@ static int __e1000_resume(struct pci_dev *pdev) #ifdef CONFIG_PM_SLEEP static int e1000e_pm_thaw(struct device *dev) { - struct net_device *netdev = pci_get_drvdata(to_pci_dev(dev)); + struct net_device *netdev = dev_get_drvdata(dev); struct e1000_adapter *adapter = netdev_priv(netdev); e1000e_set_interrupt_capability(adapter); @@ -6679,8 +6679,7 @@ static int e1000e_pm_resume(struct device *dev) static int e1000e_pm_runtime_idle(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - struct net_device *netdev = pci_get_drvdata(pdev); + struct net_device *netdev = dev_get_drvdata(dev); struct e1000_adapter *adapter = netdev_priv(netdev); u16 eee_lp; @@ -7105,7 +7104,7 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) netdev->irq = pdev->irq; - pci_set_drvdata(pdev, netdev); + dev_set_drvdata(&pdev->dev, netdev); adapter = netdev_priv(netdev); hw = &adapter->hw; adapter->netdev = netdev; From patchwork Wed Jul 24 06:06:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuhong Yuan X-Patchwork-Id: 1136085 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=osuosl.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lWplJEeo"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45tlGW6t6fz9sBF for ; Wed, 24 Jul 2019 16:06:27 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 5DD6C86661; Wed, 24 Jul 2019 06:06:26 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qklf-t8WjmBS; Wed, 24 Jul 2019 06:06:25 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 8B2A3865A1; Wed, 24 Jul 2019 06:06:25 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 4D2BC1BF5A9 for ; Wed, 24 Jul 2019 06:06:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 34F038515C for ; Wed, 24 Jul 2019 06:06:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dasQHUzWua8U for ; Wed, 24 Jul 2019 06:06:23 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by hemlock.osuosl.org (Postfix) with ESMTPS id 13D8585096 for ; Wed, 24 Jul 2019 06:06:23 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id s1so14329690pgr.2 for ; Tue, 23 Jul 2019 23:06:23 -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=31L/qG3uJMYvnLAjCarmZ4oT4ALMlS1kE3KgO5pog3g=; b=lWplJEeoBfrY353cEV/p5nOjvGIvJVBe59G1UDivAKDjp9N7Vx9h1QWFXs8uVnd5mE y2Ca0ZzHo0Y2Xld8sexXiBU/ASfW1KtiisdxnA6Fd77hdCLAwvXuajFvpmmQ3rVK8In2 t2GA3Z7Blo6tlw2oEj5mNwaSOIXT/7NsYyv+enUc4bXQvQhUt5Yc8qS4/8/gSAGlC/A2 f2rgndjiwbcRj8jBsKI4VP5AnKSoDht6oef6lGSewxs/wrlXUTl7RoQRs7yMIeLfG7fp RNV1JwDQReRgZVjwJzZiBIwBZOXZVIoyd0CWPFIIV0molb4KMcgvesEFoHSW4i340AGS Z7Fg== 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=31L/qG3uJMYvnLAjCarmZ4oT4ALMlS1kE3KgO5pog3g=; b=Q9ALi7cn/5gbQGUyaRXLu3yWf40cRlBZfw8zhqmkVntyZqZw1uvs+ayXk90bc/mYvM G7ENrTA6dhjbLa13GnIyBkSXeIutC2t/dXCP8dit8Dsy+L7aSA8IjKSgioeFwm2E0bsP 9Ulet8XBC7p5TgMGF5ocGGPWQfkQet8K0+BnyxbjP1YKBDalPWs/ndpDkiW7NmEmBjhH fysCq56K5V3jN1NQdDPQ015TT588yWYCxuOZkJ6sstuViReR2cAO34x0omGkRWOZy33A kBaqr9s7j5pEKwIPg0upmul0q/s8Y4kqgfVhkO9AyU9hEq3HJskMo3WXZTR4ttWbRXXD G1dg== X-Gm-Message-State: APjAAAWP2Cotw1RyMJF15JzzaCaOUhv4yeZCLr/1MBrjejIsJRAG5+nv TPB1acSZcFF4O2qQfBTcfOg= X-Google-Smtp-Source: APXvYqyPJ3BSLpDt4aRKGj8tCni/KPLWD/iSfVWWqh03RP+V5jqQCGaSpJF5CtsYHcWmiJK31+Mziw== X-Received: by 2002:a63:1749:: with SMTP id 9mr27305810pgx.0.1563948382607; Tue, 23 Jul 2019 23:06:22 -0700 (PDT) Received: from suzukaze.ipads-lab.se.sjtu.edu.cn ([89.31.126.54]) by smtp.gmail.com with ESMTPSA id c23sm31908495pgj.62.2019.07.23.23.06.20 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 23 Jul 2019 23:06:22 -0700 (PDT) From: Chuhong Yuan To: Date: Wed, 24 Jul 2019 14:06:17 +0800 Message-Id: <20190724060617.24170-1-hslester96@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Intel-wired-lan] [PATCH net-next v2 5/8] fm10k: Use dev_get_drvdata X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, Chuhong Yuan , linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, "David S . Miller" Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" 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/fm10k/fm10k_pci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c index e49fb51d3613..b4aa49b53c61 100644 --- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c +++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c @@ -2144,7 +2144,7 @@ static int fm10k_probe(struct pci_dev *pdev, const struct pci_device_id *ent) SET_NETDEV_DEV(netdev, &pdev->dev); interface = netdev_priv(netdev); - pci_set_drvdata(pdev, interface); + dev_set_drvdata(&pdev->dev, interface); interface->netdev = netdev; interface->pdev = pdev; @@ -2352,7 +2352,7 @@ static int fm10k_handle_resume(struct fm10k_intfc *interface) **/ static int __maybe_unused fm10k_resume(struct device *dev) { - struct fm10k_intfc *interface = pci_get_drvdata(to_pci_dev(dev)); + struct fm10k_intfc *interface = dev_get_drvdata(dev); struct net_device *netdev = interface->netdev; struct fm10k_hw *hw = &interface->hw; int err; @@ -2379,7 +2379,7 @@ static int __maybe_unused fm10k_resume(struct device *dev) **/ static int __maybe_unused fm10k_suspend(struct device *dev) { - struct fm10k_intfc *interface = pci_get_drvdata(to_pci_dev(dev)); + struct fm10k_intfc *interface = dev_get_drvdata(dev); struct net_device *netdev = interface->netdev; netif_device_detach(netdev); From patchwork Wed Jul 24 06:06:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuhong Yuan X-Patchwork-Id: 1136087 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=osuosl.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="sW/w6n2h"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45tlGh1kBPz9sBF for ; Wed, 24 Jul 2019 16:06:36 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 923198669F; Wed, 24 Jul 2019 06:06:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pMmXujhN2Sk9; Wed, 24 Jul 2019 06:06:33 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id D8944865A1; Wed, 24 Jul 2019 06:06:33 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 6CE2D1BF5A9 for ; Wed, 24 Jul 2019 06:06:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 6919C85D55 for ; Wed, 24 Jul 2019 06:06:32 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rtU0nc5dHc5z for ; Wed, 24 Jul 2019 06:06:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 038BC85B11 for ; Wed, 24 Jul 2019 06:06:32 +0000 (UTC) Received: by mail-pl1-f194.google.com with SMTP id m9so21470038pls.8 for ; 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=JyPoAFV4Q9ltTxvt4xdpTsuB4s7XFtiI8ghPeN/hiVdfT3I/imlGhj8uKpFjWf80e5 8xOj5PiS2JqRb8uV4V0eDKnBt1Dw3CngPb8AbGT6mjk259cnw2ZoYGRwCbQODRSmWWM0 /an+Gp9u3flE2325MPY6GwvR9zDc1jKAEQ6OyisvyD9GpO2e6zXhUrtpq07V065DOeit Z0mQuux93xWj4nx8bkJZzBqD2KLiC/fcXm60D8xr3ztIYUWK65CNEeFTslld6Ahwc+Yh zlY1zeUo5ZOFr0Dp44Xe1gPskoXTEdLK5jruZVBZEISPzE5KB7eq9ksVMRQs8R9tbVx7 BeQw== X-Gm-Message-State: APjAAAV/c3kz0Lv2MvfbsDXr3iw/g5ieXFM6MmHRTfOU0IM0/4cPDzsi G0JC159+1SbCQA0TmXDk9/k= X-Google-Smtp-Source: APXvYqwNHriMH8crPUN1Wh3LKQJ2MX1rmYLWHRP5Lq3+ywwtmuQ6uSfFowasvLVuVKiEsKIJWxKtDQ== 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 To: 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 Subject: [Intel-wired-lan] [PATCH net-next v2 6/8] i40e: Use dev_get_drvdata X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, Chuhong Yuan , linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, "David S . Miller" Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" 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); } From patchwork Wed Jul 24 06:06:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuhong Yuan X-Patchwork-Id: 1136090 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=osuosl.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="JdS7ifxw"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45tlGv63xlz9s4Y for ; Wed, 24 Jul 2019 16:06:47 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 2C91285D6C; Wed, 24 Jul 2019 06:06:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DTm9YFaY7XTa; Wed, 24 Jul 2019 06:06:43 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 9732685D55; Wed, 24 Jul 2019 06:06:43 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 914A01BF5A9 for ; Wed, 24 Jul 2019 06:06:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 1282C85D55 for ; Wed, 24 Jul 2019 06:06:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id j54cZqA2Oopv for ; Wed, 24 Jul 2019 06:06:39 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 912B185B11 for ; Wed, 24 Jul 2019 06:06:38 +0000 (UTC) Received: by mail-pf1-f196.google.com with SMTP id t16so20337151pfe.11 for ; Tue, 23 Jul 2019 23:06:38 -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=+1HMfJjTxMmt6yq++N5V1yBpZofp5uwv8IyU21fY09c=; b=JdS7ifxwE5qDaTMSddnrdpqo9R9gPEQj/gz1fqKljkmbd2SaAplf3F0DSQKVQEO4FS QAK4ELOErHgMoo2VKVENGOz9dzr4hHEApog1mJWsE0Bn58E0kOVyhNSf+M3rNiEkdJRc fkNctifv/t8AvuNwjL88aNZbbTJT09gAPeprHC28MywLmXm0Aty32f7lQP/b5HdJk79g jNpn9GkZ3p7kCNuI28jLl2wP6qv6fMZQeLx/vegsNS9LJ+3Gvh65hQUJuvezhf8LoWvv 6k/h5/9USe7Y6iLNRmS2H1/fLPtb5CN7Ygea19y1sEhER5TlS65gRL/3/FXBaYjxEznW 07mg== 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=+1HMfJjTxMmt6yq++N5V1yBpZofp5uwv8IyU21fY09c=; b=PI/2J1YMV8cXX/a4703jhgwXf5cEUhGOf4VZWaLmIpZknyVYKjkXk3/knsRzzkHgBy lhwgIyFs3SMUDcQQ7N3n0V/8aAXOALNClFnfZzPBAxpwUHgHICtE35kklNaJHgT9ePqH /fCBNsspsso5sqTvZWh1lcstTGG5ywByqrQQ32Ncn3/zIdpDp3O6oU+o9osZpjpW9NS9 sNM640pAzmxDrG3q0zPI08CLeZ4qnOFfOZUpZlq06SHis5OmCzmU94S3BGQw5+7UFiCk DYEmhvSHRs2SONpYO0i1B9VuongB/DaWh+qTDBoKDBXgfkDto8StrHS1ZlsErpkIv8bh Flsg== X-Gm-Message-State: APjAAAUITf3AyToMwIX2+RZTuCktPmAkgljFj8bQaLnY74B50HzYKIkC /sl88yG2PtUN6YTNZWBVoqg= X-Google-Smtp-Source: APXvYqzOXgXuZYtmgP1MoJxtOZOC9ioO4gK6RyHz2B7lwyoIGdQG/TTs7Wpl4gfJbhuIGrYlQYXzfA== X-Received: by 2002:a17:90a:258b:: with SMTP id k11mr82378025pje.110.1563948398256; Tue, 23 Jul 2019 23:06:38 -0700 (PDT) Received: from suzukaze.ipads-lab.se.sjtu.edu.cn ([89.31.126.54]) by smtp.gmail.com with ESMTPSA id c23sm31909568pgj.62.2019.07.23.23.06.35 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 23 Jul 2019 23:06:37 -0700 (PDT) From: Chuhong Yuan To: Date: Wed, 24 Jul 2019 14:06:33 +0800 Message-Id: <20190724060633.24280-1-hslester96@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Intel-wired-lan] [PATCH net-next v2 7/8] igb: Use dev_get_drvdata where possible X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, Chuhong Yuan , linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, "David S . Miller" Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" 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/igb/igb_main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index b4df3e319467..ed301428c0ce 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -3048,7 +3048,7 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) SET_NETDEV_DEV(netdev, &pdev->dev); - pci_set_drvdata(pdev, netdev); + dev_set_drvdata(&pdev->dev, netdev); adapter = netdev_priv(netdev); adapter->netdev = netdev; adapter->pdev = pdev; @@ -8879,8 +8879,7 @@ static int __maybe_unused igb_resume(struct device *dev) static int __maybe_unused igb_runtime_idle(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - struct net_device *netdev = pci_get_drvdata(pdev); + struct net_device *netdev = dev_get_drvdata(dev); struct igb_adapter *adapter = netdev_priv(netdev); if (!igb_has_link(adapter))