aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394/nodemgr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ieee1394/nodemgr.c')
-rw-r--r--drivers/ieee1394/nodemgr.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c
index 874d4d47a19c..629a9d88a0da 100644
--- a/drivers/ieee1394/nodemgr.c
+++ b/drivers/ieee1394/nodemgr.c
@@ -1738,7 +1738,19 @@ exit:
1738 return 0; 1738 return 0;
1739} 1739}
1740 1740
1741int nodemgr_for_each_host(void *__data, int (*cb)(struct hpsb_host *, void *)) 1741/**
1742 * nodemgr_for_each_host - call a function for each IEEE 1394 host
1743 * @data: an address to supply to the callback
1744 * @cb: function to call for each host
1745 *
1746 * Iterate the hosts, calling a given function with supplied data for each host.
1747 * If the callback fails on a host, i.e. if it returns a non-zero value, the
1748 * iteration is stopped.
1749 *
1750 * Return value: 0 on success, non-zero on failure (same as returned by last run
1751 * of the callback).
1752 */
1753int nodemgr_for_each_host(void *data, int (*cb)(struct hpsb_host *, void *))
1742{ 1754{
1743 struct class_device *cdev; 1755 struct class_device *cdev;
1744 struct hpsb_host *host; 1756 struct hpsb_host *host;
@@ -1748,7 +1760,7 @@ int nodemgr_for_each_host(void *__data, int (*cb)(struct hpsb_host *, void *))
1748 list_for_each_entry(cdev, &hpsb_host_class.children, node) { 1760 list_for_each_entry(cdev, &hpsb_host_class.children, node) {
1749 host = container_of(cdev, struct hpsb_host, class_dev); 1761 host = container_of(cdev, struct hpsb_host, class_dev);
1750 1762
1751 if ((error = cb(host, __data))) 1763 if ((error = cb(host, data)))
1752 break; 1764 break;
1753 } 1765 }
1754 up(&hpsb_host_class.sem); 1766 up(&hpsb_host_class.sem);
@@ -1771,12 +1783,20 @@ int nodemgr_for_each_host(void *__data, int (*cb)(struct hpsb_host *, void *))
1771 * ID's. 1783 * ID's.
1772 */ 1784 */
1773 1785
1774void hpsb_node_fill_packet(struct node_entry *ne, struct hpsb_packet *pkt) 1786/**
1787 * hpsb_node_fill_packet - fill some destination information into a packet
1788 * @ne: destination node
1789 * @packet: packet to fill in
1790 *
1791 * This will fill in the given, pre-initialised hpsb_packet with the current
1792 * information from the node entry (host, node ID, bus generation number).
1793 */
1794void hpsb_node_fill_packet(struct node_entry *ne, struct hpsb_packet *packet)
1775{ 1795{
1776 pkt->host = ne->host; 1796 packet->host = ne->host;
1777 pkt->generation = ne->generation; 1797 packet->generation = ne->generation;
1778 barrier(); 1798 barrier();
1779 pkt->node_id = ne->nodeid; 1799 packet->node_id = ne->nodeid;
1780} 1800}
1781 1801
1782int hpsb_node_write(struct node_entry *ne, u64 addr, 1802int hpsb_node_write(struct node_entry *ne, u64 addr,