Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8748559ybi; Tue, 23 Jul 2019 14:25:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwO6pJz3E5MX0Duws//wVgeVEughUgwd/8ShapMoOEtyOv4rog/Bi5Q93igJUt64Xufp7Mb X-Received: by 2002:aa7:8392:: with SMTP id u18mr7818946pfm.72.1563917128996; Tue, 23 Jul 2019 14:25:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563917128; cv=none; d=google.com; s=arc-20160816; b=eQ4U3dU8pS85QKFuqJmwa7BUHfPXatogi8tlPYdHtkVG6Fz+SRMVdKbMUTj14KA0eM QCl2NKSQ7H4bUYnP5aak2jMZFIfTPI5kr4tL1C0yqYvEByd6yIyTuXYK+u83y79wC/+j 7wnuOtRHfIleXuLiMv58qRHS2TBekKAROM9zqzCiPoKf6/RImMtz6sEArKlKp3c/67uy xXvJGNY2Sc01faj1yLF16o+JV3pZMwkwzKuMrSI8dyQK/sv62nimVpr+ND2PVzrPbjvC MUUcvw/VYJHuuqa0OjUG5JsiQJ9ZFh/W13VWKTZquce4VIGBL5FNlF2NPD4VRM4HaP2B i/kQ== 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=hLE+uvTLBw9PwWML02QRkRdkEaxbje4YIX9zUI0ZUnc=; b=EsAM4dSiEHkmHS90ilCAZ4ja9IKu2r1W5DcRD9StA7gIr7J9GHj30FpAO3pGUh9eHF jBk/9qCsrhSPEkzbHYpQ7lTFXOEQ+CoP5Fdijt3z8dMqnOlAsIp760VNko37/XU8rAqL ycgX4L1yy+2ziziJUbdbx8iiaZ1jkwIP00mwb8Tc6kQuxZ9844HXqMeTHUJkOP4P2uKc o/aJlGlP5z32SOxxbjZ+iGv4GvGIpYMe6l5qLWX9yzmiUZQO+iNZqurW6qOSj/6shDFi +VUkpCrcrQD4hX9zCoHt09a/yzH9jgIatDF5mA9bOOeK9nlCyB7EqwZM3RDYNWyGnSbE 2QqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=s2yL5v4p; 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 d5si10508580plo.396.2019.07.23.14.24.58; Tue, 23 Jul 2019 14:25:28 -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=s2yL5v4p; 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 S2387454AbfGWLLQ (ORCPT + 99 others); Tue, 23 Jul 2019 07:11:16 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:38752 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726709AbfGWLLQ (ORCPT ); Tue, 23 Jul 2019 07:11:16 -0400 Received: by mail-pf1-f193.google.com with SMTP id y15so18981808pfn.5; Tue, 23 Jul 2019 04:11:15 -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=hLE+uvTLBw9PwWML02QRkRdkEaxbje4YIX9zUI0ZUnc=; b=s2yL5v4pdf2a5iHalxCn1uyDwXhBF7kNoqnlkEsHZJZWLe65EAkNcNsjCtLoQKjh9F /ng32Olv7Qsj6XMr5mjWZBDjR1rKaLweZe5zbNN5CAujGDw9ZcXdYyJNgA0OiQCqqX1c MwEQHzkpK3LT28WNE/BxUA1vPo4KiFz+XWZM2tVnabsC1BQCWWvbpN8eKR+ctaUUcZkV h+2ckclyhLDyHPijSs+T1gHpKURtzgpZGmkxebScKhGZiUejNxmRhhZ6J48ZwoN8MPC0 RrONS2zUVy+lns5i7RighM+ng4LRD6jYuzGVXsAm0jbTUPYMNpWb14XjzqfsUNl4pWkm VkoA== 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=hLE+uvTLBw9PwWML02QRkRdkEaxbje4YIX9zUI0ZUnc=; b=R3wkUUuqIlDAHjzJEdUH3aQmJahV6Ev0el5/vw8P6EV0MZJ4OQlryxm9Itpu7VFLHj GSF1aUZNR6ejPJ93IDJXlN8Rd+eT8sAFOLCMDfP7vLyOoADl/+kLR7f16kXLEeB5PXlS LzD++MnS691MyYXfQvNUGQFoH2At9XiQRLJCXQZ61a94IsojVZ653/Lc7YjZ5744g/zo nxJ4YqXtmPA2Vmlj/ZbluuvyuZA3EbOL1oo/XSPFeV4pFUT6AkOBocjduNrOuCtKtGIV zgbJy2xxGkZ7/BNTU/otecJGwNl/oOOul2RYazqWgzgu4Wkz7LYGO91PRJG9Zq3qxdLO hRkg== X-Gm-Message-State: APjAAAXNc6749sWS8AFCZJv5iu0Cd+Lccl6412JQxGUt2jhMDc9TmJxh dPjucoLDZHjh3MHjzVaQQLkTRovH61A= X-Received: by 2002:a65:640d:: with SMTP id a13mr75434935pgv.256.1563880275480; Tue, 23 Jul 2019 04:11:15 -0700 (PDT) Received: from suzukaze.ipads-lab.se.sjtu.edu.cn ([89.31.126.54]) by smtp.gmail.com with ESMTPSA id l25sm52282284pff.143.2019.07.23.04.11.13 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 23 Jul 2019 04:11:14 -0700 (PDT) From: Chuhong Yuan Cc: Jarkko Nikula , Jean Delvare , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Chuhong Yuan Subject: [PATCH] i2c: busses: Use dev_get_drvdata where possible Date: Tue, 23 Jul 2019 19:11:10 +0800 Message-Id: <20190723111110.11121-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 --- drivers/i2c/busses/i2c-designware-pcidrv.c | 6 ++---- drivers/i2c/busses/i2c-i801.c | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c index 76810deb2de6..7d2e6959679c 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c @@ -173,8 +173,7 @@ static struct dw_pci_controller dw_pci_controllers[] = { #ifdef CONFIG_PM static int i2c_dw_pci_suspend(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - struct dw_i2c_dev *i_dev = pci_get_drvdata(pdev); + struct dw_i2c_dev *i_dev = dev_get_drvdata(dev); i_dev->suspended = true; i_dev->disable(i_dev); @@ -184,8 +183,7 @@ static int i2c_dw_pci_suspend(struct device *dev) static int i2c_dw_pci_resume(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - struct dw_i2c_dev *i_dev = pci_get_drvdata(pdev); + struct dw_i2c_dev *i_dev = dev_get_drvdata(dev); int ret; ret = i_dev->init(i_dev); diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index f2956936c3f2..a6469978e735 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -1912,8 +1912,7 @@ static int i801_suspend(struct device *dev) static int i801_resume(struct device *dev) { - struct pci_dev *pci_dev = to_pci_dev(dev); - struct i801_priv *priv = pci_get_drvdata(pci_dev); + struct i801_priv *priv = dev_get_drvdata(dev); i801_enable_host_notify(&priv->adapter); -- 2.20.1