* [PATCH] scsi: libfc: directly call ELS request handlers
@ 2017-04-07 13:42 Johannes Thumshirn
2017-04-07 16:15 ` Chad Dupuis
2017-04-12 0:59 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Johannes Thumshirn @ 2017-04-07 13:42 UTC (permalink / raw)
To: Martin K . Petersen
Cc: Linux SCSI Mailinglist, Linux Kernel Mailinglist, Johannes Thumshirn
Directly call ELS request handler functions in fc_lport_recv_els_req
instead of saving the pointer to the handler's receive function and then
later dereferencing this pointer.
This makes the code a bit more obvious.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
drivers/scsi/libfc/fc_lport.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index aa76f36..2fd0ec6 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -887,8 +887,6 @@ static void fc_lport_recv_flogi_req(struct fc_lport *lport,
static void fc_lport_recv_els_req(struct fc_lport *lport,
struct fc_frame *fp)
{
- void (*recv)(struct fc_lport *, struct fc_frame *);
-
mutex_lock(&lport->lp_mutex);
/*
@@ -902,31 +900,31 @@ static void fc_lport_recv_els_req(struct fc_lport *lport,
/*
* Check opcode.
*/
- recv = fc_rport_recv_req;
switch (fc_frame_payload_op(fp)) {
case ELS_FLOGI:
if (!lport->point_to_multipoint)
- recv = fc_lport_recv_flogi_req;
+ fc_lport_recv_flogi_req(lport, fp);
break;
case ELS_LOGO:
if (fc_frame_sid(fp) == FC_FID_FLOGI)
- recv = fc_lport_recv_logo_req;
+ fc_lport_recv_logo_req(lport, fp);
break;
case ELS_RSCN:
- recv = lport->tt.disc_recv_req;
+ lport->tt.disc_recv_req(lport, fp);
break;
case ELS_ECHO:
- recv = fc_lport_recv_echo_req;
+ fc_lport_recv_echo_req(lport, fp);
break;
case ELS_RLIR:
- recv = fc_lport_recv_rlir_req;
+ fc_lport_recv_rlir_req(lport, fp);
break;
case ELS_RNID:
- recv = fc_lport_recv_rnid_req;
+ fc_lport_recv_rnid_req(lport, fp);
+ break;
+ default:
+ fc_rport_recv_req(lport, fp);
break;
}
-
- recv(lport, fp);
}
mutex_unlock(&lport->lp_mutex);
}
--
1.8.5.6
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] scsi: libfc: directly call ELS request handlers
2017-04-07 13:42 [PATCH] scsi: libfc: directly call ELS request handlers Johannes Thumshirn
@ 2017-04-07 16:15 ` Chad Dupuis
2017-04-12 0:59 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Chad Dupuis @ 2017-04-07 16:15 UTC (permalink / raw)
To: Johannes Thumshirn
Cc: Martin K . Petersen, Linux SCSI Mailinglist, Linux Kernel Mailinglist
On Fri, 7 Apr 2017, 1:42pm -0000, Johannes Thumshirn wrote:
> Directly call ELS request handler functions in fc_lport_recv_els_req
> instead of saving the pointer to the handler's receive function and then
> later dereferencing this pointer.
>
> This makes the code a bit more obvious.
>
> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
> ---
> drivers/scsi/libfc/fc_lport.c | 20 +++++++++-----------
> 1 file changed, 9 insertions(+), 11 deletions(-)
>
A reasonable refactoring.
Reviewed-by: Chad Dupuis <chad.dupuis@cavium.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi: libfc: directly call ELS request handlers
2017-04-07 13:42 [PATCH] scsi: libfc: directly call ELS request handlers Johannes Thumshirn
2017-04-07 16:15 ` Chad Dupuis
@ 2017-04-12 0:59 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2017-04-12 0:59 UTC (permalink / raw)
To: Johannes Thumshirn
Cc: Martin K . Petersen, Linux SCSI Mailinglist, Linux Kernel Mailinglist
Johannes Thumshirn <jthumshirn@suse.de> writes:
> Directly call ELS request handler functions in fc_lport_recv_els_req
> instead of saving the pointer to the handler's receive function and then
> later dereferencing this pointer.
Applied to 4.12/scsi-queue.
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-12 0:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-07 13:42 [PATCH] scsi: libfc: directly call ELS request handlers Johannes Thumshirn
2017-04-07 16:15 ` Chad Dupuis
2017-04-12 0:59 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®