Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5414803ybi; Tue, 4 Jun 2019 06:23:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqwz5vZ1JB3iGJoGNboywMArggRD4JQtXY65e9tofibfCAUYmrLMliD0wu80NF3nN7DSK0ur X-Received: by 2002:a17:902:ac81:: with SMTP id h1mr31092833plr.129.1559654625210; Tue, 04 Jun 2019 06:23:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559654625; cv=none; d=google.com; s=arc-20160816; b=Ta4bvCTOsJqU0WLQ/oDrcGyk3Jn090xL6yzZTaU0+g90wYg5+XA+kNjaxjEU7UJJP3 1PHMVcY37mpGBsXLhtNVaVtyRa3dCLotYRZqEXlZOuiwo/1O2kLA8VLJOI8gLRL4StqZ JyJf3WMV23G2Yb9jhhwARPk4r5pke3iuqCNylGgOzsDaViEMP8Glzc60KKcxsEvbIIWd iY6bY4b0I8J6yb0wMRtHjnV3KCY+nsQQ/3WzF5qNFOP9qEn4fy7BDvCtUl8pWL0qp90C okNyn2JZFCOfAW51h8YjZWX86ier8laiyjAf+N1hVbACRvB2fGmRv6CDFBnVL8Aqz5uY gUMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=wpR76pUQZD8qw+8R4/pRwOkQY9ta5s2pKOPuv5GPy44=; b=qrhwwfmL1qOlPr7/0YMiFD/12h/snPvPsW7TT+qWbC+no1dzOSZ5hWvXJjYDX7MTgC phATh4JxhqP5T8snONDzeYsgSjXxmZzxZdg7NJLIz47epPN4H6e9tAf91Mfj2fteFujg x9b9FRrx1AL+Dbr5XCwWGUVdKSN6hsex9zKGT69Qo6DIHW9ry5B8DNK/85KW0jPS8R1m WmN1zz0uKnUENYaASrSw+JneoQ+fLRMy3Inn7OFQgBIqbuVDdu2IMiaqsl1um78FxmEN zBAqWe2PJxhn3dx4v66jVP8YLYJSAsSZ2M+M6xt85vwfvFEr0ED3JqscQxMQEqthqfTT /jrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=gQFje2xL; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o6si23531788pgh.163.2019.06.04.06.23.27; Tue, 04 Jun 2019 06:23:45 -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=@ti.com header.s=ti-com-17Q1 header.b=gQFje2xL; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727621AbfFDNUS (ORCPT + 99 others); Tue, 4 Jun 2019 09:20:18 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:35648 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727153AbfFDNUR (ORCPT ); Tue, 4 Jun 2019 09:20:17 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x54DJLQF092301; Tue, 4 Jun 2019 08:19:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1559654361; bh=wpR76pUQZD8qw+8R4/pRwOkQY9ta5s2pKOPuv5GPy44=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=gQFje2xLV6IMR3s1mQL6R8PIVlNv//UIzSUzajaVG+d2jd1GH1XFlYZVEW+KPGA/s aACev+SCMDgAv7roiJxX92r9dpX0CyGcgKW8yfLIq/jgxvXnrnwwD/cEMvZh1e3DrU 6S1frA2Wewxa2WnxVF+7qAtUZUxam6eAunZ2d4z0= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x54DJLtD054916 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 4 Jun 2019 08:19:21 -0500 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 4 Jun 2019 08:19:20 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 4 Jun 2019 08:19:20 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x54DGdGi098972; Tue, 4 Jun 2019 08:19:15 -0500 From: Kishon Vijay Abraham I To: Tom Joseph , Bjorn Helgaas , Rob Herring , Mark Rutland , Lorenzo Pieralisi , Arnd Bergmann , Gustavo Pimentel CC: Greg Kroah-Hartman , Frank Rowand , Jingoo Han , , , , , , , Kishon Vijay Abraham I Subject: [RFC PATCH 28/30] misc: pci_endpoint_test: Avoid using module parameter to determine irqtype Date: Tue, 4 Jun 2019 18:45:14 +0530 Message-ID: <20190604131516.13596-29-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190604131516.13596-1-kishon@ti.com> References: <20190604131516.13596-1-kishon@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit e03327122e2c8e6ae4565ef ("pci_endpoint_test: Add 2 ioctl commands") uses module parameter in pci_endpoint_test_set_irq() 'irqtype' to check if irq vectors of a particular type is already allocated. However with multi-function devices, irqtype will not correctly reflect the irq type of the PCI device. Fix it here by adding 'irqtype' for each PCI device to shows the irq type of that particular PCI device. Signed-off-by: Kishon Vijay Abraham I --- drivers/misc/pci_endpoint_test.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c index 98a60f4d45a1..632c76e33e4e 100644 --- a/drivers/misc/pci_endpoint_test.c +++ b/drivers/misc/pci_endpoint_test.c @@ -110,6 +110,7 @@ struct pci_endpoint_test { struct completion irq_raised; int last_irq; int num_irqs; + int irq_type; /* mutex to protect the ioctls */ struct mutex mutex; struct miscdevice miscdev; @@ -169,6 +170,7 @@ static void pci_endpoint_test_free_irq_vectors(struct pci_endpoint_test *test) struct pci_dev *pdev = test->pdev; pci_free_irq_vectors(pdev); + test->irq_type = IRQ_TYPE_UNDEFINED; } static bool pci_endpoint_test_alloc_irq_vectors(struct pci_endpoint_test *test, @@ -203,6 +205,8 @@ static bool pci_endpoint_test_alloc_irq_vectors(struct pci_endpoint_test *test, irq = 0; res = false; } + + test->irq_type = type; test->num_irqs = irq; return res; @@ -342,6 +346,7 @@ static bool pci_endpoint_test_copy(struct pci_endpoint_test *test, size_t size) dma_addr_t orig_dst_phys_addr; size_t offset; size_t alignment = test->alignment; + int irq_type = test->irq_type; u32 src_crc32; u32 dst_crc32; @@ -438,6 +443,7 @@ static bool pci_endpoint_test_write(struct pci_endpoint_test *test, size_t size) dma_addr_t orig_phys_addr; size_t offset; size_t alignment = test->alignment; + int irq_type = test->irq_type; u32 crc32; if (size > SIZE_MAX - alignment) @@ -506,6 +512,7 @@ static bool pci_endpoint_test_read(struct pci_endpoint_test *test, size_t size) dma_addr_t orig_phys_addr; size_t offset; size_t alignment = test->alignment; + int irq_type = test->irq_type; u32 crc32; if (size > SIZE_MAX - alignment) @@ -567,7 +574,7 @@ static bool pci_endpoint_test_set_irq(struct pci_endpoint_test *test, return false; } - if (irq_type == req_irq_type) + if (test->irq_type == req_irq_type) return true; pci_endpoint_test_release_irq(test); @@ -579,12 +586,10 @@ static bool pci_endpoint_test_set_irq(struct pci_endpoint_test *test, if (!pci_endpoint_test_request_irq(test)) goto err; - irq_type = req_irq_type; return true; err: pci_endpoint_test_free_irq_vectors(test); - irq_type = IRQ_TYPE_UNDEFINED; return false; } -- 2.17.1