From e01ec74601b58f54a5e2ae7b9fd1196972034114 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Fri, 24 Jun 2011 14:14:41 +0100 Subject: [process] Pass containing object pointer to process step() methods Give the step() method a pointer to the containing object, rather than a pointer to the process. This is consistent with the operation of interface methods, and allows a single function to serve as both an interface method and a process step() method. Signed-off-by: Michael Brown --- src/net/80211/net80211.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/net/80211') diff --git a/src/net/80211/net80211.c b/src/net/80211/net80211.c index f5ab65f04..466d1243e 100644 --- a/src/net/80211/net80211.c +++ b/src/net/80211/net80211.c @@ -159,7 +159,7 @@ net80211_marshal_request_info ( struct net80211_device *dev, * @defgroup net80211_assoc_ll 802.11 association handling functions * @{ */ -static void net80211_step_associate ( struct process *proc ); +static void net80211_step_associate ( struct net80211_device *dev ); static void net80211_handle_auth ( struct net80211_device *dev, struct io_buffer *iob ); static void net80211_handle_assoc_reply ( struct net80211_device *dev, @@ -729,6 +729,11 @@ int net80211_tx_mgmt ( struct net80211_device *dev, u16 fc, u8 dest[6], /* ---------- Driver API ---------- */ +/** 802.11 association process descriptor */ +static struct process_descriptor net80211_process_desc = + PROC_DESC ( struct net80211_device, proc_assoc, + net80211_step_associate ); + /** * Allocate 802.11 device * @@ -760,7 +765,7 @@ struct net80211_device * net80211_alloc ( size_t priv_size ) dev->priv = ( u8 * ) dev + sizeof ( *dev ); dev->op = &net80211_null_ops; - process_init_stopped ( &dev->proc_assoc, net80211_step_associate, + process_init_stopped ( &dev->proc_assoc, &net80211_process_desc, &netdev->refcnt ); INIT_LIST_HEAD ( &dev->mgmt_queue ); INIT_LIST_HEAD ( &dev->mgmt_info_queue ); @@ -1630,12 +1635,10 @@ void net80211_free_wlanlist ( struct list_head *list ) /** * Step 802.11 association process * - * @v proc Association process + * @v dev 802.11 device */ -static void net80211_step_associate ( struct process *proc ) +static void net80211_step_associate ( struct net80211_device *dev ) { - struct net80211_device *dev = - container_of ( proc, struct net80211_device, proc_assoc ); int rc = 0; int status = dev->state & NET80211_STATUS_MASK; @@ -1836,7 +1839,7 @@ static void net80211_step_associate ( struct process *proc ) dev->rctl = rc80211_init ( dev ); - process_del ( proc ); + process_del ( &dev->proc_assoc ); DBGC ( dev, "802.11 %p associated with %s (%s)\n", dev, dev->essid, eth_ntoa ( dev->bssid ) ); @@ -1861,7 +1864,7 @@ static void net80211_step_associate ( struct process *proc ) net80211_free_wlan ( dev->associating ); dev->associating = NULL; - process_del ( proc ); + process_del ( &dev->proc_assoc ); DBGC ( dev, "802.11 %p association failed (state=%04x): " "%s\n", dev, dev->state, strerror ( dev->assoc_rc ) ); -- cgit v1.2.3-55-g7522