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/drivers/block/scsi.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/drivers') diff --git a/src/drivers/block/scsi.c b/src/drivers/block/scsi.c index d14165134..016a6c55a 100644 --- a/src/drivers/block/scsi.c +++ b/src/drivers/block/scsi.c @@ -892,11 +892,9 @@ static struct interface_descriptor scsidev_ready_desc = /** * SCSI TEST UNIT READY process * - * @v process Process + * @v scsidev SCSI device */ -static void scsidev_step ( struct process *process ) { - struct scsi_device *scsidev = - container_of ( process, struct scsi_device, process ); +static void scsidev_step ( struct scsi_device *scsidev ) { int rc; /* Wait until underlying SCSI device is ready */ @@ -926,6 +924,10 @@ static struct interface_descriptor scsidev_scsi_desc = INTF_DESC_PASSTHRU ( struct scsi_device, scsi, scsidev_scsi_op, block ); +/** SCSI device process descriptor */ +static struct process_descriptor scsidev_process_desc = + PROC_DESC ( struct scsi_device, process, scsidev_step ); + /** * Open SCSI device * @@ -946,7 +948,8 @@ int scsi_open ( struct interface *block, struct interface *scsi, intf_init ( &scsidev->block, &scsidev_block_desc, &scsidev->refcnt ); intf_init ( &scsidev->scsi, &scsidev_scsi_desc, &scsidev->refcnt ); intf_init ( &scsidev->ready, &scsidev_ready_desc, &scsidev->refcnt ); - process_init ( &scsidev->process, scsidev_step, &scsidev->refcnt ); + process_init ( &scsidev->process, &scsidev_process_desc, + &scsidev->refcnt ); INIT_LIST_HEAD ( &scsidev->cmds ); memcpy ( &scsidev->lun, lun, sizeof ( scsidev->lun ) ); DBGC ( scsidev, "SCSI %p created for LUN " SCSI_LUN_FORMAT "\n", -- cgit v1.2.3-55-g7522