[pxe] Create pxe_[de]activate() wrapper functions

Merge the pxe_set_netdev()+pxe_[un]hook_int1a() pattern into a single
pxe_[de]activate() call.
This commit is contained in:
Michael Brown
2009-06-28 20:08:58 +01:00
parent c2965b0fe7
commit 07b5be3341
4 changed files with 61 additions and 40 deletions

View File

@@ -44,27 +44,24 @@ struct image_type pxe_image_type __image_type ( PROBE_PXE );
* @ret rc Return status code
*/
static int pxe_exec ( struct image *image ) {
struct net_device *netdev;
int rc;
/* Ensure that PXE stack is ready to use */
pxe_hook_int1a();
/* Arbitrarily pick the most recently opened network device */
pxe_set_netdev ( last_opened_netdev() );
/* Many things will break if pxe_netdev is NULL */
if ( ! pxe_netdev ) {
if ( ( netdev = last_opened_netdev() ) == NULL ) {
DBGC ( image, "IMAGE %p could not locate PXE net device\n",
image );
return -ENODEV;
}
/* Activate PXE */
pxe_activate ( netdev );
/* Start PXE NBP */
rc = pxe_start_nbp();
/* Deactivate PXE */
pxe_set_netdev ( NULL );
pxe_unhook_int1a();
pxe_deactivate();
return rc;
}