From: Jon Hunter <jonathanh@nvidia.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Olof Johansson <olof@lixom.net>,
"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Grant Grundler <grundler@google.com>,
Olof Johansson <olofj@chromium.org>,
Seshagiri Holi <sholi@nvidia.com>
Subject: Re: [RFC PATCH] mmc: block: Add new ioctl to send combo commands
Date: Thu, 10 Sep 2015 09:43:42 +0100 [thread overview]
Message-ID: <55F142BE.5020403@nvidia.com> (raw)
In-Reply-To: <CAPDyKFqFd+Dki6rbhEah_10z4eyfT1WaDmAUpagqQJc56-9B1A@mail.gmail.com>
Hi Ulf,
On 09/09/15 13:42, Ulf Hansson wrote:
[snip]
>> +static int mmc_blk_ioctl_cmd(struct block_device *bdev,
>> + struct mmc_ioc_cmd __user *ic_ptr)
>> +{
>> + struct mmc_blk_ioc_data *idata;
>> + struct mmc_blk_data *md;
>> + struct mmc_card *card;
>> + int err;
>> +
>> + /*
>> + * The caller must have CAP_SYS_RAWIO, and must be calling this on the
>> + * whole block device, not on a partition. This prevents overspray
>> + * between sibling partitions.
>> + */
>> + if ((!capable(CAP_SYS_RAWIO)) || (bdev != bdev->bd_contains))
>> + return -EPERM;
>> +
>> + idata = mmc_blk_ioctl_copy_from_user(ic_ptr);
>> + if (IS_ERR(idata))
>> + return PTR_ERR(idata);
>> +
>> + md = mmc_blk_get(bdev->bd_disk);
>> + if (!md) {
>> + err = -EINVAL;
>> + goto cmd_err;
>> + }
>> +
>> + card = md->queue.card;
>> + if (IS_ERR(card)) {
>> + err = PTR_ERR(card);
>> + goto cmd_done;
>> + }
>> +
>> + mmc_claim_host(card->host);
>
> As __mmc_blk_ioctl_cmd() already does mmc_get_card(), you don't need
> mmc_claim_host() here.
Thinking about this some more, does it make sense to have a
mmc_get_card() above and then remove the one from __mmc_blk_ioctl_cmd()?
The mmc_blk_ioctl_multi_cmd() needs to call mmc_get_card() before
calling __mmc_blk_ioctl_cmd() and so currently we are calling
mmc_get_card() twice in the case of mmc_blk_ioctl_multi_cmd() which
seems unnecessary.
Cheers
Jon
next prev parent reply other threads:[~2015-09-10 8:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-02 14:21 [RFC PATCH] mmc: block: Add new ioctl to send combo commands Jon Hunter
2015-09-02 18:28 ` Olof Johansson
[not found] ` <CANEJEGsb=bSyqYW6K5eXr8PwUrJxokOHz894ofk4F-SRohGeQQ@mail.gmail.com>
2015-09-02 22:08 ` Grant Grundler
2015-09-03 15:10 ` Jon Hunter
2015-09-04 1:16 ` Grant Grundler
[not found] ` <CANEJEGsGfr9j8AZz-mpC=a87QX9+OJwtESCASR_t5_SYqbV8fg@mail.gmail.com>
2015-09-08 9:18 ` Jon Hunter
2015-09-03 15:08 ` Jon Hunter
2015-09-09 12:42 ` Ulf Hansson
2015-09-09 13:59 ` Jon Hunter
2015-09-10 8:43 ` Jon Hunter [this message]
2015-09-10 10:13 ` Ulf Hansson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55F142BE.5020403@nvidia.com \
--to=jonathanh@nvidia.com \
--cc=grundler@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=olof@lixom.net \
--cc=olofj@chromium.org \
--cc=sholi@nvidia.com \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.