Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8993958ybi; Tue, 23 Jul 2019 19:39:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqxP4bbogwQ8i+OvHBVIxS+ZHPKsviJLfnYdXG0Z97yjWaxBeYuamwUiRpzu1RrpG64t9Nm6 X-Received: by 2002:a17:90a:ad93:: with SMTP id s19mr85078177pjq.36.1563935961102; Tue, 23 Jul 2019 19:39:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563935961; cv=none; d=google.com; s=arc-20160816; b=IJVEzIGCMWvTsy6YseU7UV4PhfWDILKI0Ey1ar0I5AFJQsMAVwBrmdxPjAiPKkdIFK HW4tURvM9gKgkggjHJqgVvMH1fSGB8+TrhHY+RJyhbirpkET5IKNqO8b4TryjY98E6qP 10Abmq5/VimHHlfjvOQYglea6HVCoVwZ9/vHPsQLxN9vWW3mJD2BoUUH0qmfz1K21J+u 0wsSBNrSk12PpYgEo5l7k9voPxcAUZ/gSMFMgZcT6FizP27u2OKjcZrJSf9ZqmTQK7JZ /HGqZEZusE2JEPmIo/uQXM6J2lW9jIeIkEsDq2kT3STrRjJK26V5MW6W/8lEs/od0oYp XnPA== 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=MHXWLNkBi4IYlJRSCQ7XL9Ay+J09vpF8KwLPUC4SKIU=; b=d1+ILNOpXid6uO+4rc6fon13JPKV6C3WzLdr39opVwH0LReTqN2hsSoxfwgJBU4zUS 4bHr1foYmS/5coi9xlJzp00UK7mk63tDvWtXatGiTnzpQwO8gzxZC7WcDh/9o8XVJGJB hVSyFDpIldo/JaJnWjZ/T/2ke7FRH7pbVeCONqr5pj0ut5p21GCz4ztvoKJ10VtjcF2V DPwPj2egnbm6x163bfMoUMEnyJEBMnakCV0yhwRzYGM29Y7c2mBL3/XspuHMx+wvPcgJ D3IS0C4Yp9QLii9esPGkSme6j9h3xWweB6CfpkIUvz5n5nSl5QnrGQuP9YK0QGpPiRzP rmoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=IESMVaT8; 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 bg3si11158021plb.83.2019.07.23.19.39.06; Tue, 23 Jul 2019 19:39:21 -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=IESMVaT8; 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 S1728811AbfGXCCQ (ORCPT + 99 others); Tue, 23 Jul 2019 22:02:16 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:39700 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728776AbfGXCCP (ORCPT ); Tue, 23 Jul 2019 22:02:15 -0400 Received: by mail-pg1-f195.google.com with SMTP id u17so20337918pgi.6; Tue, 23 Jul 2019 19:02: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=MHXWLNkBi4IYlJRSCQ7XL9Ay+J09vpF8KwLPUC4SKIU=; b=IESMVaT8yvh5w1FIxv4hRPats+B4/ECJQn4da/rPuLLeeTvwXzcp7WupjkHeGFjVvV zRC1QulnMvcrutEg6lvLQBQwwuFeib0Fkg0t2GQb6QrqyFeQ8d36iJyMFXzo8BoQFRiI 0/zYR5iXQ4G9TvZ/pUbbDl0OFZASDij6hig3+YGw5ueZlMdSL/jEF8DzkgkU47dmcEJf 57jjFmQie9JXwdMi7BTqla4dNRDdypp9jAKUgddRoGfzbj13X6Hep+X5rj3ClCgjQTnY GMX4/qJHpBFucfV6XDbR9g9QZpEYDdQO8NWzBJXCPWmb1pdmr5d/tvemxr/zTVgoGPza Dnqg== 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=MHXWLNkBi4IYlJRSCQ7XL9Ay+J09vpF8KwLPUC4SKIU=; b=VF8xsUFirMq09CFGwORbQ9LSt063yQFcgkQE0zXwBrL4qIUSTbLzovPnoVlc6tuOR+ kKIfmcWu2LPaacxJ/9jB4/uF+fRnxG1bapzlOk1Jd0IFp+Ex34wO21irs/wLr4T8a5RV lQyvwuI9sSrJMnk6Pq0s6/0mz+3U+T+OndIQiPjvjSE1ZcIFWsC7To+cVOTDcFbuf2mw MuzGDSsyJ538Qm/4cNjbY8LRP8t55UKyH/WzmIyznFkwTYUDYY+iGd77ibDvDC9WhaUj GQVrxCB4OMSGw3riydge0OfApI1hwy2JnllF74FCauuiE9D1fEiG/mSIYHFyHuNGRQOV fTOQ== X-Gm-Message-State: APjAAAUBvWaphJXC33lpUaLJa6DES/JrVOBZI2dLzLW8Ucrb9/9qJGlS /GVbdGYpPakftbTpnN33yaEVtL25xmk= X-Received: by 2002:a65:4b89:: with SMTP id t9mr10206526pgq.55.1563933734972; Tue, 23 Jul 2019 19:02:14 -0700 (PDT) Received: from suzukaze.ipads-lab.se.sjtu.edu.cn ([89.31.126.54]) by smtp.gmail.com with ESMTPSA id b19sm41008521pgh.57.2019.07.23.19.02.11 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 23 Jul 2019 19:02:14 -0700 (PDT) From: Chuhong Yuan Cc: Yong Zhi , Sakari Ailus , Bingbu Cao , Mauro Carvalho Chehab , Akihiro Tsukada , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Chuhong Yuan Subject: [PATCH v2] media: pci: Use dev_get_drvdata where possible Date: Wed, 24 Jul 2019 10:02:06 +0800 Message-Id: <20190724020206.11044-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/media/pci/intel/ipu3/ipu3-cio2.c | 5 ++--- drivers/media/pci/pt1/pt1.c | 8 +++----- drivers/media/pci/pt3/pt3.c | 8 +++----- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c index c1d133e17e4b..2b2c77c2fc7e 100644 --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c @@ -1765,7 +1765,7 @@ static int cio2_pci_probe(struct pci_dev *pci_dev, cio2->base = iomap[CIO2_PCI_BAR]; - pci_set_drvdata(pci_dev, cio2); + dev_set_drvdata(&pci_dev->dev, cio2); pci_set_master(pci_dev); @@ -2000,8 +2000,7 @@ static int __maybe_unused cio2_suspend(struct device *dev) static int __maybe_unused cio2_resume(struct device *dev) { - struct pci_dev *pci_dev = to_pci_dev(dev); - struct cio2_device *cio2 = pci_get_drvdata(pci_dev); + struct cio2_device *cio2 = dev_get_drvdata(dev); int r = 0; struct cio2_queue *q = cio2->cur_queue; diff --git a/drivers/media/pci/pt1/pt1.c b/drivers/media/pci/pt1/pt1.c index e51c80bc4646..06f25b658a76 100644 --- a/drivers/media/pci/pt1/pt1.c +++ b/drivers/media/pci/pt1/pt1.c @@ -1217,8 +1217,7 @@ static void pt1_i2c_init(struct pt1 *pt1) static int pt1_suspend(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - struct pt1 *pt1 = pci_get_drvdata(pdev); + struct pt1 *pt1 = dev_get_drvdata(dev); pt1_init_streams(pt1); pt1_disable_ram(pt1); @@ -1230,8 +1229,7 @@ static int pt1_suspend(struct device *dev) static int pt1_resume(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - struct pt1 *pt1 = pci_get_drvdata(pdev); + struct pt1 *pt1 = dev_get_drvdata(dev); int ret; int i; @@ -1371,7 +1369,7 @@ static int pt1_probe(struct pci_dev *pdev, const struct pci_device_id *ent) pt1->regs = regs; pt1->fe_clk = (pdev->device == 0x211a) ? PT1_FE_CLK_20MHZ : PT1_FE_CLK_25MHZ; - pci_set_drvdata(pdev, pt1); + dev_set_drvdata(&pdev->dev, pt1); ret = pt1_init_adapters(pt1); if (ret < 0) diff --git a/drivers/media/pci/pt3/pt3.c b/drivers/media/pci/pt3/pt3.c index 7a7afae4c84c..ab09e0f2ed99 100644 --- a/drivers/media/pci/pt3/pt3.c +++ b/drivers/media/pci/pt3/pt3.c @@ -626,8 +626,7 @@ static void pt3_cleanup_adapter(struct pt3_board *pt3, int index) static int pt3_suspend(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - struct pt3_board *pt3 = pci_get_drvdata(pdev); + struct pt3_board *pt3 = dev_get_drvdata(dev); int i; struct pt3_adapter *adap; @@ -646,8 +645,7 @@ static int pt3_suspend(struct device *dev) static int pt3_resume(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - struct pt3_board *pt3 = pci_get_drvdata(pdev); + struct pt3_board *pt3 = dev_get_drvdata(dev); int i, ret; struct pt3_adapter *adap; @@ -734,7 +732,7 @@ static int pt3_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ret = -ENOMEM; goto err_release_regions; } - pci_set_drvdata(pdev, pt3); + dev_set_drvdata(&pdev->dev, pt3); pt3->pdev = pdev; mutex_init(&pt3->lock); pt3->regs[0] = pci_ioremap_bar(pdev, 0); -- 2.20.1