aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJoe Eykholt <jeykholt@cisco.com>2009-08-25 17:02:01 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-09-10 13:07:47 -0400
commit8345592b8388b51e0f52f63e94a5a5d3f07fda9a (patch)
treec1552168982507bc331a3163a62106c649179941 /drivers/scsi
parent19f97e3c0acc5eb03486044f5428395b7690a01a (diff)
[SCSI] libfc: change to make remote port callback optional
Since the rport list maintenance is now done in the rport module, the callback (and ops) are usually not necessary. Allow rdata->ops to be left NULL if nothing needs to be done in an event callback. Signed-off-by: Joe Eykholt <jeykholt@cisco.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/libfc/fc_disc.c45
-rw-r--r--drivers/scsi/libfc/fc_rport.c4
2 files changed, 5 insertions, 44 deletions
diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
index 266aa1ea01e4..3fcbba171863 100644
--- a/drivers/scsi/libfc/fc_disc.c
+++ b/drivers/scsi/libfc/fc_disc.c
@@ -92,37 +92,6 @@ void fc_disc_stop_rports(struct fc_disc *disc)
92} 92}
93 93
94/** 94/**
95 * fc_disc_rport_callback() - Event handler for rport events
96 * @lport: The lport which is receiving the event
97 * @rdata: private remote port data
98 * @event: The event that occured
99 *
100 * Locking Note: The rport lock should not be held when calling
101 * this function.
102 */
103static void fc_disc_rport_callback(struct fc_lport *lport,
104 struct fc_rport_priv *rdata,
105 enum fc_rport_event event)
106{
107 struct fc_disc *disc = &lport->disc;
108
109 FC_DISC_DBG(disc, "Received a %d event for port (%6x)\n", event,
110 rdata->ids.port_id);
111
112 switch (event) {
113 case RPORT_EV_READY:
114 break;
115 case RPORT_EV_LOGO:
116 case RPORT_EV_FAILED:
117 case RPORT_EV_STOP:
118 break;
119 default:
120 break;
121 }
122
123}
124
125/**
126 * fc_disc_recv_rscn_req() - Handle Registered State Change Notification (RSCN) 95 * fc_disc_recv_rscn_req() - Handle Registered State Change Notification (RSCN)
127 * @sp: Current sequence of the RSCN exchange 96 * @sp: Current sequence of the RSCN exchange
128 * @fp: RSCN Frame 97 * @fp: RSCN Frame
@@ -334,10 +303,6 @@ static void fc_disc_start(void (*disc_callback)(struct fc_lport *,
334 mutex_unlock(&disc->disc_mutex); 303 mutex_unlock(&disc->disc_mutex);
335} 304}
336 305
337static struct fc_rport_operations fc_disc_rport_ops = {
338 .event_callback = fc_disc_rport_callback,
339};
340
341/** 306/**
342 * fc_disc_new_target() - Handle new target found by discovery 307 * fc_disc_new_target() - Handle new target found by discovery
343 * @lport: FC local port 308 * @lport: FC local port
@@ -381,10 +346,8 @@ static int fc_disc_new_target(struct fc_disc *disc,
381 if (!rdata) 346 if (!rdata)
382 error = -ENOMEM; 347 error = -ENOMEM;
383 } 348 }
384 if (rdata) { 349 if (rdata)
385 rdata->ops = &fc_disc_rport_ops;
386 lport->tt.rport_login(rdata); 350 lport->tt.rport_login(rdata);
387 }
388 } 351 }
389 return error; 352 return error;
390} 353}
@@ -551,10 +514,9 @@ static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len)
551 if (ids.port_id != fc_host_port_id(lport->host) && 514 if (ids.port_id != fc_host_port_id(lport->host) &&
552 ids.port_name != lport->wwpn) { 515 ids.port_name != lport->wwpn) {
553 rdata = lport->tt.rport_create(lport, &ids); 516 rdata = lport->tt.rport_create(lport, &ids);
554 if (rdata) { 517 if (rdata)
555 rdata->ops = &fc_disc_rport_ops;
556 lport->tt.rport_login(rdata); 518 lport->tt.rport_login(rdata);
557 } else 519 else
558 printk(KERN_WARNING "libfc: Failed to allocate " 520 printk(KERN_WARNING "libfc: Failed to allocate "
559 "memory for the newly discovered port " 521 "memory for the newly discovered port "
560 "(%6x)\n", ids.port_id); 522 "(%6x)\n", ids.port_id);
@@ -697,7 +659,6 @@ static void fc_disc_single(struct fc_disc *disc, struct fc_disc_port *dp)
697 659
698 rdata = lport->tt.rport_create(lport, &dp->ids); 660 rdata = lport->tt.rport_create(lport, &dp->ids);
699 if (rdata) { 661 if (rdata) {
700 rdata->ops = &fc_disc_rport_ops;
701 kfree(dp); 662 kfree(dp);
702 lport->tt.rport_login(rdata); 663 lport->tt.rport_login(rdata);
703 } 664 }
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 29bb6fd10036..406049c13a0e 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -250,7 +250,7 @@ static void fc_rport_work(struct work_struct *work)
250 rp->r_a_tov = rdata->r_a_tov; 250 rp->r_a_tov = rdata->r_a_tov;
251 mutex_unlock(&rdata->rp_mutex); 251 mutex_unlock(&rdata->rp_mutex);
252 252
253 if (rport_ops->event_callback) { 253 if (rport_ops && rport_ops->event_callback) {
254 FC_RPORT_DBG(rdata, "callback ev %d\n", event); 254 FC_RPORT_DBG(rdata, "callback ev %d\n", event);
255 rport_ops->event_callback(lport, rdata, event); 255 rport_ops->event_callback(lport, rdata, event);
256 } 256 }
@@ -269,7 +269,7 @@ static void fc_rport_work(struct work_struct *work)
269 mutex_unlock(&lport->disc.disc_mutex); 269 mutex_unlock(&lport->disc.disc_mutex);
270 } 270 }
271 271
272 if (rport_ops->event_callback) { 272 if (rport_ops && rport_ops->event_callback) {
273 FC_RPORT_DBG(rdata, "callback ev %d\n", event); 273 FC_RPORT_DBG(rdata, "callback ev %d\n", event);
274 rport_ops->event_callback(lport, rdata, event); 274 rport_ops->event_callback(lport, rdata, event);
275 } 275 }