From patchwork Wed Dec 23 12:49:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 7911911 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E4A229F318 for ; Wed, 23 Dec 2015 12:49:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F254D203A5 for ; Wed, 23 Dec 2015 12:49:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0AE1220340 for ; Wed, 23 Dec 2015 12:49:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751462AbbLWMtk (ORCPT ); Wed, 23 Dec 2015 07:49:40 -0500 Received: from m50-132.163.com ([123.125.50.132]:50853 "EHLO m50-132.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750959AbbLWMtk (ORCPT ); Wed, 23 Dec 2015 07:49:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=4fk+SiTyM4m2YJ0oxz KOxNaQAxnD12hKkuLAg4LnNok=; b=ne+Gx3r+r/ykcRnmKv6b2nyQ1oMuCqVq9i oVgkg2m/q0L/r2jcReuHU2K0R+hL/vgv29bclWhKNCmZlqGIBarR3icgAhd+ACoK BzGkSEMUdgwWQAfpvmKZxzfeKVk/pE/nKf57h9Tlyap0zYcamnp/uCUK1D2evyPq ZHqfJDh9g= Received: from localhost (unknown [116.77.148.162]) by smtp2 (Coremail) with SMTP id DNGowEApGU0+mHpWDgR8AA--.2456S3; Wed, 23 Dec 2015 20:49:03 +0800 (CST) From: Geliang Tang To: Tom Lendacky , Herbert Xu , "David S. Miller" Cc: Geliang Tang , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] crypto: ccp - use to_pci_dev and to_platform_device Date: Wed, 23 Dec 2015 20:49:01 +0800 Message-Id: <3a86c7e2921be1783aaab4dfbb3f4021a0e2f8d4.1450874840.git.geliangtang@163.com> X-Mailer: git-send-email 2.5.0 X-CM-TRANSID: DNGowEApGU0+mHpWDgR8AA--.2456S3 X-Coremail-Antispam: 1Uf129KBjvJXoWxCw47Gw13uw43CrWrXrWxXrb_yoW5XFyfp3 Z8Jay8JrW8Gr98W3WrZw4DAF9xtrWYv34fKrWxtw1Skas0vFZ5tFW0yF1UAw1fJFWkCF13 Ja9rKr18Zw40vaUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07UQ18PUUUUU= X-Originating-IP: [116.77.148.162] X-CM-SenderInfo: 5jhoxtpqjwt0rj6rljoofrz/xtbByhzZmVO+gvhRPgABsv Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use to_pci_dev() and to_platform_device() instead of open-coding. Signed-off-by: Geliang Tang --- drivers/crypto/ccp/ccp-pci.c | 8 ++++---- drivers/crypto/ccp/ccp-platform.c | 6 ++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/crypto/ccp/ccp-pci.c b/drivers/crypto/ccp/ccp-pci.c index 6ade02f..7690467 100644 --- a/drivers/crypto/ccp/ccp-pci.c +++ b/drivers/crypto/ccp/ccp-pci.c @@ -44,7 +44,7 @@ static int ccp_get_msix_irqs(struct ccp_device *ccp) { struct ccp_pci *ccp_pci = ccp->dev_specific; struct device *dev = ccp->dev; - struct pci_dev *pdev = container_of(dev, struct pci_dev, dev); + struct pci_dev *pdev = to_pci_dev(dev); struct msix_entry msix_entry[MSIX_VECTORS]; unsigned int name_len = sizeof(ccp_pci->msix[0].name) - 1; int v, ret; @@ -86,7 +86,7 @@ e_irq: static int ccp_get_msi_irq(struct ccp_device *ccp) { struct device *dev = ccp->dev; - struct pci_dev *pdev = container_of(dev, struct pci_dev, dev); + struct pci_dev *pdev = to_pci_dev(dev); int ret; ret = pci_enable_msi(pdev); @@ -133,7 +133,7 @@ static void ccp_free_irqs(struct ccp_device *ccp) { struct ccp_pci *ccp_pci = ccp->dev_specific; struct device *dev = ccp->dev; - struct pci_dev *pdev = container_of(dev, struct pci_dev, dev); + struct pci_dev *pdev = to_pci_dev(dev); if (ccp_pci->msix_count) { while (ccp_pci->msix_count--) @@ -149,7 +149,7 @@ static void ccp_free_irqs(struct ccp_device *ccp) static int ccp_find_mmio_area(struct ccp_device *ccp) { struct device *dev = ccp->dev; - struct pci_dev *pdev = container_of(dev, struct pci_dev, dev); + struct pci_dev *pdev = to_pci_dev(dev); resource_size_t io_len; unsigned long io_flags; diff --git a/drivers/crypto/ccp/ccp-platform.c b/drivers/crypto/ccp/ccp-platform.c index 01b50cb..66dd7c9 100644 --- a/drivers/crypto/ccp/ccp-platform.c +++ b/drivers/crypto/ccp/ccp-platform.c @@ -35,8 +35,7 @@ struct ccp_platform { static int ccp_get_irq(struct ccp_device *ccp) { struct device *dev = ccp->dev; - struct platform_device *pdev = container_of(dev, - struct platform_device, dev); + struct platform_device *pdev = to_platform_device(dev); int ret; ret = platform_get_irq(pdev, 0); @@ -78,8 +77,7 @@ static void ccp_free_irqs(struct ccp_device *ccp) static struct resource *ccp_find_mmio_area(struct ccp_device *ccp) { struct device *dev = ccp->dev; - struct platform_device *pdev = container_of(dev, - struct platform_device, dev); + struct platform_device *pdev = to_platform_device(dev); struct resource *ior; ior = platform_get_resource(pdev, IORESOURCE_MEM, 0);