Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

of/irq: Make of_msi_map_rid() PCI bus agnostic

There is nothing PCI bus specific in the of_msi_map_rid()
implementation other than the requester ID tag for the input
ID space. Rename requester ID to a more generic ID so that
the translation code can be used by all busses that require
input/output ID translations.

No functional change intended.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20200619082013.13661-11-lorenzo.pieralisi@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

authored by

Lorenzo Pieralisi and committed by
Catalin Marinas
2bcdd8f2 6f881aba

+19 -19
+14 -14
drivers/of/irq.c
··· 576 576 } 577 577 } 578 578 579 - static u32 __of_msi_map_rid(struct device *dev, struct device_node **np, 580 - u32 rid_in) 579 + static u32 __of_msi_map_id(struct device *dev, struct device_node **np, 580 + u32 id_in) 581 581 { 582 582 struct device *parent_dev; 583 - u32 rid_out = rid_in; 583 + u32 id_out = id_in; 584 584 585 585 /* 586 586 * Walk up the device parent links looking for one with a 587 587 * "msi-map" property. 588 588 */ 589 589 for (parent_dev = dev; parent_dev; parent_dev = parent_dev->parent) 590 - if (!of_map_id(parent_dev->of_node, rid_in, "msi-map", 591 - "msi-map-mask", np, &rid_out)) 590 + if (!of_map_id(parent_dev->of_node, id_in, "msi-map", 591 + "msi-map-mask", np, &id_out)) 592 592 break; 593 - return rid_out; 593 + return id_out; 594 594 } 595 595 596 596 /** 597 - * of_msi_map_rid - Map a MSI requester ID for a device. 597 + * of_msi_map_id - Map a MSI ID for a device. 598 598 * @dev: device for which the mapping is to be done. 599 599 * @msi_np: device node of the expected msi controller. 600 - * @rid_in: unmapped MSI requester ID for the device. 600 + * @id_in: unmapped MSI ID for the device. 601 601 * 602 602 * Walk up the device hierarchy looking for devices with a "msi-map" 603 - * property. If found, apply the mapping to @rid_in. 603 + * property. If found, apply the mapping to @id_in. 604 604 * 605 - * Returns the mapped MSI requester ID. 605 + * Returns the mapped MSI ID. 606 606 */ 607 - u32 of_msi_map_rid(struct device *dev, struct device_node *msi_np, u32 rid_in) 607 + u32 of_msi_map_id(struct device *dev, struct device_node *msi_np, u32 id_in) 608 608 { 609 - return __of_msi_map_rid(dev, &msi_np, rid_in); 609 + return __of_msi_map_id(dev, &msi_np, id_in); 610 610 } 611 611 612 612 /** 613 613 * of_msi_map_get_device_domain - Use msi-map to find the relevant MSI domain 614 614 * @dev: device for which the mapping is to be done. 615 - * @rid: Requester ID for the device. 615 + * @id: Device ID. 616 616 * @bus_token: Bus token 617 617 * 618 618 * Walk up the device hierarchy looking for devices with a "msi-map" ··· 625 625 { 626 626 struct device_node *np = NULL; 627 627 628 - __of_msi_map_rid(dev, &np, id); 628 + __of_msi_map_id(dev, &np, id); 629 629 return irq_find_matching_host(np, bus_token); 630 630 } 631 631
+1 -1
drivers/pci/msi.c
··· 1535 1535 pci_for_each_dma_alias(pdev, get_msi_id_cb, &rid); 1536 1536 1537 1537 of_node = irq_domain_get_of_node(domain); 1538 - rid = of_node ? of_msi_map_rid(&pdev->dev, of_node, rid) : 1538 + rid = of_node ? of_msi_map_id(&pdev->dev, of_node, rid) : 1539 1539 iort_msi_map_id(&pdev->dev, rid); 1540 1540 1541 1541 return rid;
+4 -4
include/linux/of_irq.h
··· 55 55 u32 id, 56 56 u32 bus_token); 57 57 extern void of_msi_configure(struct device *dev, struct device_node *np); 58 - u32 of_msi_map_rid(struct device *dev, struct device_node *msi_np, u32 rid_in); 58 + u32 of_msi_map_id(struct device *dev, struct device_node *msi_np, u32 id_in); 59 59 #else 60 60 static inline int of_irq_count(struct device_node *dev) 61 61 { ··· 93 93 static inline void of_msi_configure(struct device *dev, struct device_node *np) 94 94 { 95 95 } 96 - static inline u32 of_msi_map_rid(struct device *dev, 97 - struct device_node *msi_np, u32 rid_in) 96 + static inline u32 of_msi_map_id(struct device *dev, 97 + struct device_node *msi_np, u32 id_in) 98 98 { 99 - return rid_in; 99 + return id_in; 100 100 } 101 101 #endif 102 102