cxlflash: Split out context initialization
authorMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
Fri, 4 Mar 2016 21:55:16 +0000 (15:55 -0600)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 9 Mar 2016 02:17:33 +0000 (21:17 -0500)
commit5e6632d19ea2fafaec1b7c4cda7f7157ee8ad983
tree083307c2211a29108de926d9d06722fdcb096d35
parent6ded8b3cbd9a6254da5a38f35e20aa3c316d9092
cxlflash: Split out context initialization

Presently, context information structures are allocated and
initialized in the same routine, create_context(). This imposes
an ordering restriction such that all pieces of information needed
to initialize a context must be known before the context is even
allocated.

This design point is not flexible when the order of context
creation needs to be modified. Specifically, this can lead to
problems when members of the context information structure are
a part of an ordering dependency (i.e. - the 'work' structure
embedded within the context).

To remedy, the allocation is left as-is, inside of the existing
create_context() routine and the initialization is transitioned
to a new void routine, init_context(). At the same time, in
anticipation of these routines not being called in sequence, a
state boolean is added to the context information structure to
track when the context has been initilized. The context teardown
routine, destroy_context(), is modified to support being called
with a non-initialized context.

Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Reviewed-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/cxlflash/superpipe.c
drivers/scsi/cxlflash/superpipe.h