/* We're currently switching the port group to be activated only and let the array figure out the rest. There may be other arrays which require us to switch all port groups based on a certain policy. But until we actually encounter them it should be okay.  */
static int alua_activate(struct scsi_device *sdev, activate_complete fn, void *data)
/* We're currently switching the port group to be activated only and let the array figure out the rest. There may be other arrays which require us to switch all port groups based on a certain policy. But until we actually encounter them it should be okay.  */
static int alua_activate(struct scsi_device *sdev, activate_complete fn, void *data)
{
	struct alua_dh_data *h = get_alua_data(sdev);
	int err = SCSI_DH_OK;
	if (h->group_id != -1) {
		err = alua_rtpg(sdev, h);
		if (err != SCSI_DH_OK)
			goto out;
	}
	if (h->tpgs & TPGS_MODE_EXPLICIT && h->state != TPGS_STATE_OPTIMIZED) {
		h->callback_fn = fn;
		h->callback_data = data;
		err = submit_stpg(h);
		if (err == SCSI_DH_OK)
			return 0;
		h->callback_fn = h->callback_data = NULL;
	}
out:
	if (fn)
		fn(data, err);
	return 0;
}