Message ID | 20190605073942.125577-2-hare@suse.de (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | [1/4] libfc: kill lld_event_callback | expand |
On 6/5/19 12:39 AM, Hannes Reinecke wrote: > It will only ever be set so another callback, and the pointer to > this callback is available on all locations. So kill it. > > Signed-off-by: Hannes Reinecke <hare@suse.com> > --- > drivers/scsi/libfc/fc_rport.c | 13 ++++++------- > include/scsi/libfc.h | 3 --- > 2 files changed, 6 insertions(+), 10 deletions(-) > > diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c > index 0da34c7a6866..255e6568be66 100644 > --- a/drivers/scsi/libfc/fc_rport.c > +++ b/drivers/scsi/libfc/fc_rport.c > @@ -155,10 +155,9 @@ struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, u32 port_id) > rdata->maxframe_size = FC_MIN_MAX_PAYLOAD; > INIT_DELAYED_WORK(&rdata->retry_work, fc_rport_timeout); > INIT_WORK(&rdata->event_work, fc_rport_work); > - if (port_id != FC_FID_DIR_SERV) { > - rdata->lld_event_callback = lport->tt.rport_event_callback; > + if (port_id != FC_FID_DIR_SERV) > list_add_rcu(&rdata->peers, &lport->disc.rports); > - } > + > return rdata; > } > EXPORT_SYMBOL(fc_rport_create); > @@ -308,9 +307,9 @@ static void fc_rport_work(struct work_struct *work) > FC_RPORT_DBG(rdata, "callback ev %d\n", event); > rport_ops->event_callback(lport, rdata, event); > } > - if (rdata->lld_event_callback) { > + if (lport->tt.rport_event_callback) { > FC_RPORT_DBG(rdata, "lld callback ev %d\n", event); > - rdata->lld_event_callback(lport, rdata, event); > + lport->tt.rport_event_callback(lport, rdata, event); > } > kref_put(&rdata->kref, fc_rport_destroy); > break; > @@ -334,9 +333,9 @@ static void fc_rport_work(struct work_struct *work) > FC_RPORT_DBG(rdata, "callback ev %d\n", event); > rport_ops->event_callback(lport, rdata, event); > } > - if (rdata->lld_event_callback) { > + if (lport->tt.rport_event_callback) { > FC_RPORT_DBG(rdata, "lld callback ev %d\n", event); > - rdata->lld_event_callback(lport, rdata, event); > + lport->tt.rport_event_callback(lport, rdata, event); > } > if (cancel_delayed_work_sync(&rdata->retry_work)) > kref_put(&rdata->kref, fc_rport_destroy); > diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h > index 76cb9192319a..2c3c5b9e7cc6 100644 > --- a/include/scsi/libfc.h > +++ b/include/scsi/libfc.h > @@ -212,9 +212,6 @@ struct fc_rport_priv { > struct rcu_head rcu; > u16 sp_features; > u8 spp_type; > - void (*lld_event_callback)(struct fc_lport *, > - struct fc_rport_priv *, > - enum fc_rport_event); > }; Before this patch lport->tt.rport_event_callback was not called for ports of type FC_FID_DIR_SERV. This patch causes that callback function also to be called for ports of type FC_FID_DIR_SERV. Is that change acceptable? If so, please mention this in the commit message. Thanks, Bart.
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c index 0da34c7a6866..255e6568be66 100644 --- a/drivers/scsi/libfc/fc_rport.c +++ b/drivers/scsi/libfc/fc_rport.c @@ -155,10 +155,9 @@ struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, u32 port_id) rdata->maxframe_size = FC_MIN_MAX_PAYLOAD; INIT_DELAYED_WORK(&rdata->retry_work, fc_rport_timeout); INIT_WORK(&rdata->event_work, fc_rport_work); - if (port_id != FC_FID_DIR_SERV) { - rdata->lld_event_callback = lport->tt.rport_event_callback; + if (port_id != FC_FID_DIR_SERV) list_add_rcu(&rdata->peers, &lport->disc.rports); - } + return rdata; } EXPORT_SYMBOL(fc_rport_create); @@ -308,9 +307,9 @@ static void fc_rport_work(struct work_struct *work) FC_RPORT_DBG(rdata, "callback ev %d\n", event); rport_ops->event_callback(lport, rdata, event); } - if (rdata->lld_event_callback) { + if (lport->tt.rport_event_callback) { FC_RPORT_DBG(rdata, "lld callback ev %d\n", event); - rdata->lld_event_callback(lport, rdata, event); + lport->tt.rport_event_callback(lport, rdata, event); } kref_put(&rdata->kref, fc_rport_destroy); break; @@ -334,9 +333,9 @@ static void fc_rport_work(struct work_struct *work) FC_RPORT_DBG(rdata, "callback ev %d\n", event); rport_ops->event_callback(lport, rdata, event); } - if (rdata->lld_event_callback) { + if (lport->tt.rport_event_callback) { FC_RPORT_DBG(rdata, "lld callback ev %d\n", event); - rdata->lld_event_callback(lport, rdata, event); + lport->tt.rport_event_callback(lport, rdata, event); } if (cancel_delayed_work_sync(&rdata->retry_work)) kref_put(&rdata->kref, fc_rport_destroy); diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h index 76cb9192319a..2c3c5b9e7cc6 100644 --- a/include/scsi/libfc.h +++ b/include/scsi/libfc.h @@ -212,9 +212,6 @@ struct fc_rport_priv { struct rcu_head rcu; u16 sp_features; u8 spp_type; - void (*lld_event_callback)(struct fc_lport *, - struct fc_rport_priv *, - enum fc_rport_event); }; /**
It will only ever be set so another callback, and the pointer to this callback is available on all locations. So kill it. Signed-off-by: Hannes Reinecke <hare@suse.com> --- drivers/scsi/libfc/fc_rport.c | 13 ++++++------- include/scsi/libfc.h | 3 --- 2 files changed, 6 insertions(+), 10 deletions(-)