On Mon, Sep 17, 2018 at 07:08:55PM +0300, Avri Altman wrote: > Do that for the currently supported UPIUs: > query, nop out, and task management. > > We do not support UPIU of type scsi command yet, while > we are using the job's request and reply pointers to hold > the payload. We will look into it in later patches. > We might need to elaborate the raw upiu api for that. > > We also still not supporting uic commands: > For first phase, we plan to use the existing api, > and send only uic commands that are already supported. > Anyway, all that will come in the next patch. > > Signed-off-by: Avri Altman <avri.altman@xxxxxxx> > --- > drivers/scsi/ufs/ufs_bsg.c | 121 +++++++++++++++++++++++++++++++++++++++++++-- > drivers/scsi/ufs/ufs_bsg.h | 1 + > 2 files changed, 118 insertions(+), 4 deletions(-) > > diff --git a/drivers/scsi/ufs/ufs_bsg.c b/drivers/scsi/ufs/ufs_bsg.c > index bc01d5d..adeb83a 100644 > --- a/drivers/scsi/ufs/ufs_bsg.c > +++ b/drivers/scsi/ufs/ufs_bsg.c > @@ -7,18 +7,131 @@ > #include "ufs_bsg.h" > > > +static inline struct ufs_hba *dev_to_ufs_hba(struct device *d) > +{ > + struct Scsi_Host *shost = dev_to_shost(d->parent); > + > + return shost_priv(shost); This just has one caller that culd directly do: struct ufs_hba *hba = shost_priv(dev_to_shost(job->dev-parent)); > + if (qr->opcode == UPIU_QUERY_OPCODE_WRITE_DESC) { > + rw = WRITE; > + desc_buff = ((uint8_t *)bsg_request) + > + sizeof(struct ufs_bsg_request); desc_buff = bsg_request + 1; > + } > + } > + > + req_upiu = (struct utp_upiu_req *)&bsg_request->header; > + rsp_upiu = (struct utp_upiu_req *)&bsg_reply->header; Why do we define the bsg_request/reply separately from struct utp_upiu_req instead of moving struct utp_upiu_req to the UAPI header and including it?