On 10 May 2017 at 10:24, Linus Walleij <linus.walleij@xxxxxxxxxx> wrote: > This wraps single ioctl() commands into block requests using > the custom block layer request types REQ_OP_DRV_IN and > REQ_OP_DRV_OUT. > > By doing this we are loosening the grip on the big host lock, > since two calls to mmc_get_card()/mmc_put_card() are removed. > > We are storing the ioctl() in/out argument as a pointer in > the per-request struct mmc_blk_request container. Since we > now let the block layer allocate this data, blk_get_request() > will allocate it for us and we can immediately dereference > it and use it to pass the argument into the block layer. > > Tested on the ux500 with the userspace: > mmc extcsd read /dev/mmcblk3 > resulting in a successful EXTCSD info dump back to the > console. > > Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx> > --- > drivers/mmc/core/block.c | 56 ++++++++++++++++++++++++++++++++++++++---------- [...] > @@ -1854,7 +1882,13 @@ void mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) > goto out; > } > > - if (req && req_op(req) == REQ_OP_DISCARD) { > + if (req && > + (req_op(req) == REQ_OP_DRV_IN || req_op(req) == REQ_OP_DRV_OUT)) { > + /* complete ongoing async transfer before issuing ioctl()s */ > + if (mq->qcnt) > + mmc_blk_issue_rw_rq(mq, NULL); > + mmc_blk_ioctl_cmd_issue(mq, req); > + } else if (req && req_op(req) == REQ_OP_DISCARD) { While you are at it, would you mind converting this if-else-if to a switch clause instead? [...] Kind regards Uffe -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html