mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-14 09:11:27 +00:00
[PATCH] scst: Drop detect() method
There is no need for a detect() method - code that is present in such a method can be moved to module_init(). Hence declare this method obsolete. Leave the detect pointer member in the target template for now for out-of-tree SCST drivers. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> with some improvements git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6113 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -147,7 +147,6 @@ int ft_send_xfer_rdy(struct scst_cmd *);
|
||||
void ft_cmd_timeout(struct scst_cmd *);
|
||||
void ft_cmd_free(struct scst_cmd *);
|
||||
void ft_cmd_tm_done(struct scst_mgmt_cmd *);
|
||||
int ft_tgt_detect(struct scst_tgt_template *);
|
||||
int ft_tgt_release(struct scst_tgt *);
|
||||
int ft_tgt_enable(struct scst_tgt *, bool);
|
||||
bool ft_tgt_enabled(struct scst_tgt *);
|
||||
|
||||
@@ -44,7 +44,6 @@ struct scst_tgt_template ft_scst_template = {
|
||||
.on_hw_pending_cmd_timeout = ft_cmd_timeout,
|
||||
.on_free_cmd = ft_cmd_free,
|
||||
.task_mgmt_fn_done = ft_cmd_tm_done,
|
||||
.detect = ft_tgt_detect,
|
||||
.release = ft_tgt_release,
|
||||
.report_aen = ft_report_aen,
|
||||
.enable_target = ft_tgt_enable,
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
|
||||
static void ft_sess_put(struct ft_sess *sess);
|
||||
|
||||
static int ft_tport_count;
|
||||
|
||||
static ssize_t ft_format_wwn(char *buf, size_t len, u64 wwn)
|
||||
{
|
||||
u8 b[8];
|
||||
@@ -75,7 +73,6 @@ static struct ft_tport *ft_tport_create(struct fc_lport *lport)
|
||||
return NULL;
|
||||
}
|
||||
scst_tgt_set_tgt_priv(tport->tgt, tport);
|
||||
ft_tport_count++;
|
||||
|
||||
tport->lport = lport;
|
||||
for (i = 0; i < FT_SESS_HASH_SIZE; i++)
|
||||
@@ -120,7 +117,6 @@ static void ft_tport_delete(struct ft_tport *tport)
|
||||
#else
|
||||
call_rcu(&tport->rcu, ft_tport_rcu_free);
|
||||
#endif
|
||||
ft_tport_count--;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -643,11 +639,6 @@ bool ft_tgt_enabled(struct scst_tgt *tgt)
|
||||
return tport->enabled;
|
||||
}
|
||||
|
||||
int ft_tgt_detect(struct scst_tgt_template *tt)
|
||||
{
|
||||
return ft_tport_count;
|
||||
}
|
||||
|
||||
/*
|
||||
* Report AEN (Asynchronous Event Notification) from device to initiator.
|
||||
* See notes in scst.h.
|
||||
|
||||
@@ -116,7 +116,6 @@ struct vio_port {
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
static atomic_t ibmvstgt_device_count;
|
||||
static struct workqueue_struct *vtgtd;
|
||||
static unsigned max_vdma_size = MAX_H_COPY_RDMA;
|
||||
static struct scst_tgt_template ibmvstgt_template;
|
||||
@@ -392,16 +391,6 @@ static bool ibmvstgt_is_target_enabled(struct scst_tgt *scst_tgt)
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ibmvstgt_detect() - Returns the number of target adapters.
|
||||
*
|
||||
* Callback function called by the SCST core.
|
||||
*/
|
||||
static int ibmvstgt_detect(struct scst_tgt_template *tp)
|
||||
{
|
||||
return atomic_read(&ibmvstgt_device_count);
|
||||
}
|
||||
|
||||
/**
|
||||
* ibmvstgt_release() - Free the resources associated with an SCST target.
|
||||
*
|
||||
@@ -1225,7 +1214,6 @@ static struct scst_tgt_template ibmvstgt_template = {
|
||||
.enable_target = ibmvstgt_enable_target,
|
||||
.is_target_enabled = ibmvstgt_is_target_enabled,
|
||||
#endif
|
||||
.detect = ibmvstgt_detect,
|
||||
.release = ibmvstgt_release,
|
||||
.xmit_response = ibmvstgt_xmit_response,
|
||||
.rdy_to_xfer = ibmvstgt_rdy_to_xfer,
|
||||
@@ -1308,8 +1296,6 @@ static int ibmvstgt_probe(struct vio_dev *dev, const struct vio_device_id *id)
|
||||
#endif
|
||||
goto destroy_crq_queue;
|
||||
|
||||
atomic_inc(&ibmvstgt_device_count);
|
||||
|
||||
return 0;
|
||||
|
||||
destroy_crq_queue:
|
||||
@@ -1334,8 +1320,6 @@ static int ibmvstgt_remove(struct vio_dev *dev)
|
||||
if (!target)
|
||||
return 0;
|
||||
|
||||
atomic_dec(&ibmvstgt_device_count);
|
||||
|
||||
vport = target->ldata;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
|
||||
class_device_unregister(&vport->dev);
|
||||
|
||||
@@ -3875,12 +3875,6 @@ out:
|
||||
}
|
||||
#endif
|
||||
|
||||
static int iscsi_target_detect(struct scst_tgt_template *templ)
|
||||
{
|
||||
/* Nothing to do */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int iscsi_target_release(struct scst_tgt *scst_tgt)
|
||||
{
|
||||
/* Nothing to do */
|
||||
@@ -3935,7 +3929,6 @@ struct scst_tgt_template iscsi_template = {
|
||||
.trace_tbl_help = ISCSI_TRACE_TBL_HELP,
|
||||
#endif
|
||||
#endif
|
||||
.detect = iscsi_target_detect,
|
||||
.release = iscsi_target_release,
|
||||
.xmit_response = iscsi_xmit_response,
|
||||
#if !defined(CONFIG_TCP_ZERO_COPY_TRANSFER_COMPLETION_NOTIFICATION)
|
||||
|
||||
@@ -1043,7 +1043,7 @@ struct scst_tgt_template {
|
||||
* A negative value should be returned whenever there is
|
||||
* an error.
|
||||
*
|
||||
* MUST HAVE
|
||||
* OBSOLETE
|
||||
*/
|
||||
int (*detect)(struct scst_tgt_template *tgt_template);
|
||||
|
||||
|
||||
@@ -231,12 +231,9 @@ int __scst_register_target_template(struct scst_tgt_template *vtt,
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!vtt->detect) {
|
||||
PRINT_ERROR("Target driver %s must have "
|
||||
"detect() method.", vtt->name);
|
||||
res = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
if (vtt->detect)
|
||||
PRINT_WARNING("detect() method is obsolete and scheduled for "
|
||||
"removal (target driver %s)", vtt->name);
|
||||
|
||||
if (!vtt->release) {
|
||||
PRINT_ERROR("Target driver %s must have "
|
||||
@@ -316,7 +313,7 @@ int __scst_register_target_template(struct scst_tgt_template *vtt,
|
||||
mutex_unlock(&scst_mutex);
|
||||
|
||||
TRACE_DBG("%s", "Calling target driver's detect()");
|
||||
res = vtt->detect(vtt);
|
||||
res = vtt->detect ? vtt->detect(vtt) : 0;
|
||||
TRACE_DBG("Target driver's detect() returned %d", res);
|
||||
if (res < 0) {
|
||||
PRINT_ERROR("%s", "The detect() routine failed");
|
||||
|
||||
@@ -1370,14 +1370,6 @@ out:
|
||||
return res;
|
||||
}
|
||||
|
||||
static int scst_local_targ_detect(struct scst_tgt_template *tgt_template)
|
||||
{
|
||||
TRACE_ENTRY();
|
||||
|
||||
TRACE_EXIT();
|
||||
return 0;
|
||||
};
|
||||
|
||||
static int scst_local_targ_release(struct scst_tgt *tgt)
|
||||
{
|
||||
TRACE_ENTRY();
|
||||
@@ -1574,7 +1566,6 @@ static struct scst_tgt_template scst_local_targ_tmpl = {
|
||||
.mgmt_cmd_help = " echo \"add_session target_name session_name\" >mgmt\n"
|
||||
" echo \"del_session target_name session_name\" >mgmt\n",
|
||||
#endif
|
||||
.detect = scst_local_targ_detect,
|
||||
.release = scst_local_targ_release,
|
||||
.close_session = scst_local_close_session,
|
||||
.pre_exec = scst_local_targ_pre_exec,
|
||||
|
||||
@@ -3755,16 +3755,6 @@ static void srpt_refresh_port_work(struct work_struct *work)
|
||||
srpt_refresh_port(sport);
|
||||
}
|
||||
|
||||
/**
|
||||
* srpt_detect() - Returns the number of target adapters.
|
||||
*
|
||||
* Callback function called by the SCST core.
|
||||
*/
|
||||
static int srpt_detect(struct scst_tgt_template *tp)
|
||||
{
|
||||
return atomic_read(&srpt_device_count);
|
||||
}
|
||||
|
||||
static int srpt_close_session(struct scst_session *sess)
|
||||
{
|
||||
struct srpt_rdma_ch *ch = scst_sess_get_tgt_priv(sess);
|
||||
@@ -4065,7 +4055,6 @@ static struct scst_tgt_template srpt_template = {
|
||||
.tgt_attrs = srpt_tgt_attrs,
|
||||
.sess_attrs = srpt_sess_attrs,
|
||||
#endif
|
||||
.detect = srpt_detect,
|
||||
.release = srpt_release,
|
||||
.close_session = srpt_close_session,
|
||||
.xmit_response = srpt_xmit_response,
|
||||
|
||||
Reference in New Issue
Block a user