Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1684604yba; Thu, 25 Apr 2019 04:07:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxUzwnWoq2v3ZocOQj7cX7WxGeEFXa6B1TZMz7Aq/8G9ejeUXxVhWG220BO0tu2zlnKiV5X X-Received: by 2002:a63:3284:: with SMTP id y126mr36736793pgy.424.1556190439049; Thu, 25 Apr 2019 04:07:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556190439; cv=none; d=google.com; s=arc-20160816; b=eYlkycvuB8OU3MK6hqrQf87ltIZO7TE1TiiBHuTO0UP0ajHjyId4nyYI4RlVUv7Syn USf9Ug7p7MlsC0AkJoQ8SrF9jtmTXm/F+A7iceWRxHLtyfGBYYk3hxjeuThjguOtZ3DJ Mj6xNrBfAC3smZOsYeoRPPjeX0YbRLVNQdVX+vzHeU+VJ+ptMO16vfpJkl3uYLnKGIfs /NmvocQXG9nmzGJGW2UhFA2RqtcUS0eU4cax87rU0malbkXgNxRClKrNOQfgBOHI7IFQ vv3WWb5HTu82RfRctBewG5crbxG4EX6ZvwbjvRCS1h29rfb/BwUaHmSa9B0gQ44qdzEr rmdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:dkim-signature; bh=hab7qAz6lzS7ZRowBkQ/f/HEdXNfdhNCdKWF0/BVKmE=; b=o5MDFLqZE0k8YxM7ZUlSkMDzYOW8/d0dorhSQNoJRTaxoYQOJzoxXguSHYLU9ZHdmT x26VkpujgxHci52udzK89g4XvRU5Nl86SXFmdtUjlWEfbPb2MqQeOMCqyhcZfi3u/9H/ 4z7rPTo77Sg2ItM9B0Tw202vPDYTLFAQljI5eA1+QBkURBHkYBbzL0Qh57UY9Msg/9p9 +9lEk0QRYPKWuK02Iuf5NgId/JE0u3YpjFS++nY0lN9dIZOe1348peQTaHTOUNZ+ugz6 T03+bB3hHFLXfMYQQXvBjM33eEc3em+tzOcAN87ChHtEfbv4nmEEFoT55CDRRUeA89e4 evgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IBX0KuQh; 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=pass (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 v4si20213592pgj.138.2019.04.25.04.07.02; Thu, 25 Apr 2019 04:07:19 -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=pass header.i=@gmail.com header.s=20161025 header.b=IBX0KuQh; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389087AbfDXTRv (ORCPT + 99 others); Wed, 24 Apr 2019 15:17:51 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:32927 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727357AbfDXTRt (ORCPT ); Wed, 24 Apr 2019 15:17:49 -0400 Received: by mail-wr1-f67.google.com with SMTP id s18so1864155wrp.0; Wed, 24 Apr 2019 12:17:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=hab7qAz6lzS7ZRowBkQ/f/HEdXNfdhNCdKWF0/BVKmE=; b=IBX0KuQhIHPofugi8VbvuAnaDQlqeZ9svo7oPOlRq9Nl+c4hfx7GC4G6FUzkUJubse wiLJj/sOBCAdP1NhfNYrPK8BsSVeCk2cAA9eP+HTjzeXBPDI3xwU9YjRDKxu7BUkh9Qy ARW/rPtI4IpoC3x2CibtLLT839KW5Gqd98nS+2DFcQq+T+/e7v1mCfxpxSvQXhLRtDMs OI5Y+gnOsn5tFiln6JJbcNGlizY5/JYmaoqck6PjX5tjV488YO+0nhW8BLltqBNP29iS aIYrY8Al7ib3uqnETxszQ99kc8ZoQ/z7edNx0J2Z7OwrxHfOrSpfu23Pmg27nR0v1NZi ReGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=hab7qAz6lzS7ZRowBkQ/f/HEdXNfdhNCdKWF0/BVKmE=; b=BFIapN65kxIY0ClHfmgQS2uDgvP0PZV+eufxw+YiOZw1KiSM0/+WV64GKDBB1gG4Fg 9ZDBEgj8HY6EyCSPtcEBklZ0eObBQChS4uojGhEXHPebASa3ChwbFADgGq70wiG0lZA6 aWNT5cPUPP3OgzYxXDP8rMXtnEfq1Gx/e6JVuRBf4ypHEi+KvR9oqb6KwcnDXVr29sSM juoP0nj7fNRwfERs1+xduhI0tnBMnW/KHv6zHZZLa2d1tethd+x6RoSJArEYeB+763Nv tIRhFZv779BiE58j9SD/ENzzKuyYftXo527Mx3QHS4qlL8/19WgTzg3aNiPYuIVvUUgr p4ew== X-Gm-Message-State: APjAAAV/cQlAF7CSZM/z4exK1c+P5QZmvuGp3l7Zy7XEqk5x/H5ZxeZR OG6vZ10XNHwyzcbl2m7xF/rgki1sqBGw0Q== X-Received: by 2002:a5d:4b4e:: with SMTP id w14mr18245461wrs.15.1556133466411; Wed, 24 Apr 2019 12:17:46 -0700 (PDT) Received: from ?IPv6:2003:ea:8bd4:5700:c498:ee8f:ff0a:13e5? (p200300EA8BD45700C498EE8FFF0A13E5.dip0.t-ipconnect.de. [2003:ea:8bd4:5700:c498:ee8f:ff0a:13e5]) by smtp.googlemail.com with ESMTPSA id p6sm18060129wrs.6.2019.04.24.12.17.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Apr 2019 12:17:45 -0700 (PDT) Subject: [PATCH v2 4/9] powerpc/powernv/npu: use helper pci_dev_id From: Heiner Kallweit To: Benjamin Herrenschmidt , Michael Ellerman , Oded Gabbay , Alex Deucher , =?UTF-8?Q?Christian_K=c3=b6nig?= , "David (ChunMing) Zhou" , David Airlie , Daniel Vetter , Joerg Roedel , David Woodhouse , Realtek linux nic maintainers , "David S. Miller" , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Bjorn Helgaas , Benson Leung , Enric Balletbo i Serra , Stephen Rothwell , Paul Mackerras Cc: open list , "open list:AMD KFD" , "open list:RADEON and AMDGPU DRM DRIVERS" , "open list:AMD IOMMU (AMD-VI)" , "open list:8169 10/100/1000 GIGABIT ETHERNET DRIVER" , "moderated list:ARM/STM32 ARCHITECTURE" , "moderated list:ARM/STM32 ARCHITECTURE" , "open list:PCI SUBSYSTEM" References: <2e1f9a57-6d08-d017-24da-3e6b97fa2449@gmail.com> Message-ID: <8ed5b4ee-3226-6786-eb96-886826e180cd@gmail.com> Date: Wed, 24 Apr 2019 21:14:25 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <2e1f9a57-6d08-d017-24da-3e6b97fa2449@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use new helper pci_dev_id() to simplify the code. Signed-off-by: Heiner Kallweit --- arch/powerpc/platforms/powernv/npu-dma.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/platforms/powernv/npu-dma.c b/arch/powerpc/platforms/powernv/npu-dma.c index dc23d9d2a..495550432 100644 --- a/arch/powerpc/platforms/powernv/npu-dma.c +++ b/arch/powerpc/platforms/powernv/npu-dma.c @@ -1213,9 +1213,8 @@ int pnv_npu2_map_lpar_dev(struct pci_dev *gpdev, unsigned int lparid, * Currently we only support radix and non-zero LPCR only makes sense * for hash tables so skiboot expects the LPCR parameter to be a zero. */ - ret = opal_npu_map_lpar(nphb->opal_id, - PCI_DEVID(gpdev->bus->number, gpdev->devfn), lparid, - 0 /* LPCR bits */); + ret = opal_npu_map_lpar(nphb->opal_id, pci_dev_id(gpdev), lparid, + 0 /* LPCR bits */); if (ret) { dev_err(&gpdev->dev, "Error %d mapping device to LPAR\n", ret); return ret; @@ -1224,7 +1223,7 @@ int pnv_npu2_map_lpar_dev(struct pci_dev *gpdev, unsigned int lparid, dev_dbg(&gpdev->dev, "init context opalid=%llu msr=%lx\n", nphb->opal_id, msr); ret = opal_npu_init_context(nphb->opal_id, 0/*__unused*/, msr, - PCI_DEVID(gpdev->bus->number, gpdev->devfn)); + pci_dev_id(gpdev)); if (ret < 0) dev_err(&gpdev->dev, "Failed to init context: %d\n", ret); else @@ -1258,7 +1257,7 @@ int pnv_npu2_unmap_lpar_dev(struct pci_dev *gpdev) dev_dbg(&gpdev->dev, "destroy context opalid=%llu\n", nphb->opal_id); ret = opal_npu_destroy_context(nphb->opal_id, 0/*__unused*/, - PCI_DEVID(gpdev->bus->number, gpdev->devfn)); + pci_dev_id(gpdev)); if (ret < 0) { dev_err(&gpdev->dev, "Failed to destroy context: %d\n", ret); return ret; @@ -1266,9 +1265,8 @@ int pnv_npu2_unmap_lpar_dev(struct pci_dev *gpdev) /* Set LPID to 0 anyway, just to be safe */ dev_dbg(&gpdev->dev, "Map LPAR opalid=%llu lparid=0\n", nphb->opal_id); - ret = opal_npu_map_lpar(nphb->opal_id, - PCI_DEVID(gpdev->bus->number, gpdev->devfn), 0 /*LPID*/, - 0 /* LPCR bits */); + ret = opal_npu_map_lpar(nphb->opal_id, pci_dev_id(gpdev), 0 /*LPID*/, + 0 /* LPCR bits */); if (ret) dev_err(&gpdev->dev, "Error %d mapping device to LPAR\n", ret); -- 2.21.0