Commit f6632bb2 authored by Thomas Gleixner's avatar Thomas Gleixner
Browse files

dmaengine: mv_xor_v2: Get rid of msi_desc abuse



Storing a pointer to the MSI descriptor just to keep track of the Linux
interrupt number is daft. Use msi_get_virq() instead.

Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Acked-by: default avatarVinod Koul <vkoul@kernel.org>
Link: https://lore.kernel.org/r/20211210221814.970099984@linutronix.de
parent f4823590
Loading
Loading
Loading
Loading
+5 −11
Original line number Diff line number Diff line
@@ -149,7 +149,7 @@ struct mv_xor_v2_descriptor {
 * @desc_size: HW descriptor size
 * @npendings: number of pending descriptors (for which tx_submit has
 * @hw_queue_idx: HW queue index
 * @msi_desc: local interrupt descriptor information
 * @irq: The Linux interrupt number
 * been called, but not yet issue_pending)
 */
struct mv_xor_v2_device {
@@ -168,7 +168,7 @@ struct mv_xor_v2_device {
	int desc_size;
	unsigned int npendings;
	unsigned int hw_queue_idx;
	struct msi_desc *msi_desc;
	unsigned int irq;
};

/**
@@ -718,7 +718,6 @@ static int mv_xor_v2_probe(struct platform_device *pdev)
	int i, ret = 0;
	struct dma_device *dma_dev;
	struct mv_xor_v2_sw_desc *sw_desc;
	struct msi_desc *msi_desc;

	BUILD_BUG_ON(sizeof(struct mv_xor_v2_descriptor) !=
		     MV_XOR_V2_EXT_DESC_SIZE);
@@ -770,14 +769,9 @@ static int mv_xor_v2_probe(struct platform_device *pdev)
	if (ret)
		goto disable_clk;

	msi_desc = first_msi_entry(&pdev->dev);
	if (!msi_desc) {
		ret = -ENODEV;
		goto free_msi_irqs;
	}
	xor_dev->msi_desc = msi_desc;
	xor_dev->irq = msi_get_virq(&pdev->dev, 0);

	ret = devm_request_irq(&pdev->dev, msi_desc->irq,
	ret = devm_request_irq(&pdev->dev, xor_dev->irq,
			       mv_xor_v2_interrupt_handler, 0,
			       dev_name(&pdev->dev), xor_dev);
	if (ret)
@@ -892,7 +886,7 @@ static int mv_xor_v2_remove(struct platform_device *pdev)
			  xor_dev->desc_size * MV_XOR_V2_DESC_NUM,
			  xor_dev->hw_desq_virt, xor_dev->hw_desq);

	devm_free_irq(&pdev->dev, xor_dev->msi_desc->irq, xor_dev);
	devm_free_irq(&pdev->dev, xor_dev->irq, xor_dev);

	platform_msi_domain_free_irqs(&pdev->dev);