Thread (7 messages) read the whole thread 7 messages, 2 authors, 2017-11-13

[3/4] PCI/portdrv: Implement interface to query the registered service

From: poza at codeaurora.org <hidden>
Date: 2017-11-13 23:26:31
Also in: linux-arm-msm, linux-pci

On 2017-11-14 02:22, Sinan Kaya wrote:
Some nits only.
quoted
 /**
+ * pcie_port_service_query - query if particula port service is 
enabled.
+ * dev: pcie device
+ * @port service: PCI express port service
+ */
+int pcie_port_query_service(struct pci_dev *dev, u32 port_service)
+{
+	struct pcie_device *pdev;
+	struct pci_dev *parent, *this = dev;
+
+	do {
While I understand the motivation why this function is searching for 
DPC capable
parent until the root port, the name of the function does not represent 
this.
Will change it to more relevant one.
It might make sense to split this into two where the first function 
just queries
the capabilities of the immediate device (the list_for_each_section).
quoted
+		list_for_each_entry(pdev, &this->service_list, slist) {
+			if (pdev->service == port_service)
+				return 1;
+		}
Another function to query all parents until you reach the root port.
quoted
+		parent = pci_upstream_bridge(this);
+		this = parent;
+	} while (parent && pci_is_pcie(parent));
+
+	return 0;
+}
+EXPORT_SYMBOL(pcie_port_query_service);
+
yes that makes sense; will split the function as you are suggesting.

Regards,
Oza.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help