Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1222025
| From | Jon Hunter <jonathanh@nvidia.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC PATCH] mmc: block: Add new ioctl to send combo commands |
| Date | 2015-09-10 10:50 +0200 |
| Message-ID | <q75Im-4L3-25@gated-at.bofh.it> (permalink) |
| References | <q4hd1-7Er-43@gated-at.bofh.it> <q4kXg-4BW-7@gated-at.bofh.it> <q4Ejh-78K-31@gated-at.bofh.it> <q6N8L-3wZ-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [RFC PATCH] mmc: block: Add new ioctl to send combo commands Ulf Hansson <ulf.hansson@linaro.org> - 2015-09-09 15:00 +0200
Re: [RFC PATCH] mmc: block: Add new ioctl to send combo commands Jon Hunter <jonathanh@nvidia.com> - 2015-09-09 16:00 +0200
Re: [RFC PATCH] mmc: block: Add new ioctl to send combo commands Jon Hunter <jonathanh@nvidia.com> - 2015-09-10 10:50 +0200
Re: [RFC PATCH] mmc: block: Add new ioctl to send combo commands Ulf Hansson <ulf.hansson@linaro.org> - 2015-09-10 12:20 +0200
csiph-web