scsi: target: ibm_vscsi: Replace enable attr with ops.enable
Remove tpg/enable attribute. Add fabric ops enable_tpg implementation instead. Link: https://lore.kernel.org/r/20210910084133.17956-7-d.bogdanov@yadro.com Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com> Reviewed-by: Mike Christie <michael.christie@oracle.com> Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
committed by
Martin K. Petersen
parent
9465b4871a
commit
d7e2932bba
@@ -3948,41 +3948,16 @@ static struct configfs_attribute *ibmvscsis_wwn_attrs[] = {
|
|||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static ssize_t ibmvscsis_tpg_enable_show(struct config_item *item,
|
|
||||||
char *page)
|
|
||||||
{
|
|
||||||
struct se_portal_group *se_tpg = to_tpg(item);
|
|
||||||
struct ibmvscsis_tport *tport = container_of(se_tpg,
|
|
||||||
struct ibmvscsis_tport,
|
|
||||||
se_tpg);
|
|
||||||
|
|
||||||
return snprintf(page, PAGE_SIZE, "%d\n", (tport->enabled) ? 1 : 0);
|
static int ibmvscsis_enable_tpg(struct se_portal_group *se_tpg, bool enable)
|
||||||
}
|
|
||||||
|
|
||||||
static ssize_t ibmvscsis_tpg_enable_store(struct config_item *item,
|
|
||||||
const char *page, size_t count)
|
|
||||||
{
|
{
|
||||||
struct se_portal_group *se_tpg = to_tpg(item);
|
|
||||||
struct ibmvscsis_tport *tport = container_of(se_tpg,
|
struct ibmvscsis_tport *tport = container_of(se_tpg,
|
||||||
struct ibmvscsis_tport,
|
struct ibmvscsis_tport,
|
||||||
se_tpg);
|
se_tpg);
|
||||||
struct scsi_info *vscsi = container_of(tport, struct scsi_info, tport);
|
struct scsi_info *vscsi = container_of(tport, struct scsi_info, tport);
|
||||||
unsigned long tmp;
|
|
||||||
int rc;
|
|
||||||
long lrc;
|
long lrc;
|
||||||
|
|
||||||
rc = kstrtoul(page, 0, &tmp);
|
if (enable) {
|
||||||
if (rc < 0) {
|
|
||||||
dev_err(&vscsi->dev, "Unable to extract srpt_tpg_store_enable\n");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((tmp != 0) && (tmp != 1)) {
|
|
||||||
dev_err(&vscsi->dev, "Illegal value for srpt_tpg_store_enable\n");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tmp) {
|
|
||||||
spin_lock_bh(&vscsi->intr_lock);
|
spin_lock_bh(&vscsi->intr_lock);
|
||||||
tport->enabled = true;
|
tport->enabled = true;
|
||||||
lrc = ibmvscsis_enable_change_state(vscsi);
|
lrc = ibmvscsis_enable_change_state(vscsi);
|
||||||
@@ -3998,17 +3973,8 @@ static ssize_t ibmvscsis_tpg_enable_store(struct config_item *item,
|
|||||||
spin_unlock_bh(&vscsi->intr_lock);
|
spin_unlock_bh(&vscsi->intr_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_dbg(&vscsi->dev, "tpg_enable_store, tmp %ld, state %d\n", tmp,
|
return 0;
|
||||||
vscsi->state);
|
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
}
|
||||||
CONFIGFS_ATTR(ibmvscsis_tpg_, enable);
|
|
||||||
|
|
||||||
static struct configfs_attribute *ibmvscsis_tpg_attrs[] = {
|
|
||||||
&ibmvscsis_tpg_attr_enable,
|
|
||||||
NULL,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct target_core_fabric_ops ibmvscsis_ops = {
|
static const struct target_core_fabric_ops ibmvscsis_ops = {
|
||||||
.module = THIS_MODULE,
|
.module = THIS_MODULE,
|
||||||
@@ -4038,10 +4004,10 @@ static const struct target_core_fabric_ops ibmvscsis_ops = {
|
|||||||
.fabric_make_wwn = ibmvscsis_make_tport,
|
.fabric_make_wwn = ibmvscsis_make_tport,
|
||||||
.fabric_drop_wwn = ibmvscsis_drop_tport,
|
.fabric_drop_wwn = ibmvscsis_drop_tport,
|
||||||
.fabric_make_tpg = ibmvscsis_make_tpg,
|
.fabric_make_tpg = ibmvscsis_make_tpg,
|
||||||
|
.fabric_enable_tpg = ibmvscsis_enable_tpg,
|
||||||
.fabric_drop_tpg = ibmvscsis_drop_tpg,
|
.fabric_drop_tpg = ibmvscsis_drop_tpg,
|
||||||
|
|
||||||
.tfc_wwn_attrs = ibmvscsis_wwn_attrs,
|
.tfc_wwn_attrs = ibmvscsis_wwn_attrs,
|
||||||
.tfc_tpg_base_attrs = ibmvscsis_tpg_attrs,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void ibmvscsis_dev_release(struct device *dev) {};
|
static void ibmvscsis_dev_release(struct device *dev) {};
|
||||||
|
Reference in New Issue
Block a user