From patchwork Tue Jan 29 18:13:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10786805 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 40F05139A for ; Tue, 29 Jan 2019 18:13:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E6A42CBF2 for ; Tue, 29 Jan 2019 18:13:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 21B332CC2B; Tue, 29 Jan 2019 18:13:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B21D02CBF2 for ; Tue, 29 Jan 2019 18:13:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728454AbfA2SN0 (ORCPT ); Tue, 29 Jan 2019 13:13:26 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:35150 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727368AbfA2SNZ (ORCPT ); Tue, 29 Jan 2019 13:13:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=3EpTLPTe7MxqR7rhIW83gWtXzmEP4UKkgI2JifEq9Rc=; b=h9nnQF0QAAvN7pvGRn62DMEsNk AxSGH6uiqzCT/H1UNvdMnvEj0gGKRwMMFNDhRhSf70lKsuir2NIE0OeJ4/Jxw4jLeTzm+qj4ROl2d lbXbGHhBCCwVzVF3eq2dotCD7QXeCtKcmJMKpIOZ5LuLcdEWSJ5hmRUZ/yW6kQV/D1S27no21yZ/u 3dlvDQaNSVckyWD89eyhjQElAeReT15XqJIyiSgjtfJWIoDn5wGcMjKpzeZ3M3ezUMxavWG7WpSjo 7GUR1IAC5dodo3ogK5uIA2Djeg7UC6flP+eZ7ieu8kcbNEDA4QI0ZCp8cdRo82WPNOQwtNTkGCzBe GTeQgIfg==; Received: from 213-225-35-141.nat.highway.a1.net ([213.225.35.141] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1goXsw-00082N-Qx; Tue, 29 Jan 2019 18:13:23 +0000 From: Christoph Hellwig To: "James E.J. Bottomley" , Helge Deller Cc: linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/8] parisc: turn GET_IOC into an inline function Date: Tue, 29 Jan 2019 19:13:05 +0100 Message-Id: <20190129181310.5557-4-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190129181310.5557-1-hch@lst.de> References: <20190129181310.5557-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This makes the function both more readable and more typesafe. Signed-off-by: Christoph Hellwig --- drivers/parisc/iommu.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/parisc/iommu.h b/drivers/parisc/iommu.h index 5a38b635e963..d6fd3ab899ac 100644 --- a/drivers/parisc/iommu.h +++ b/drivers/parisc/iommu.h @@ -26,10 +26,14 @@ static inline void *parisc_walk_tree(struct device *dev) return dev->platform_data; } -#define GET_IOC(dev) ({ \ - void *__pdata = parisc_walk_tree(dev); \ - __pdata ? HBA_DATA(__pdata)->iommu : NULL; \ -}) +static inline struct ioc *GET_IOC(struct device *dev) +{ + struct pci_hba_data *pdata = parisc_walk_tree(dev); + + if (!pdata) + return NULL; + return pdata->iommu; +} #ifdef CONFIG_IOMMU_CCIO void *ccio_get_iommu(const struct parisc_device *dev);