From: Jens Axboe <axboe@fb.com>
To: Andy Lutomirski <luto@amacapital.net>, Christoph Hellwig <hch@lst.de>
Cc: <linux-nvme@lists.infradead.org>,
J Freyensee <james_p_freyensee@linux.intel.com>,
Keith Busch <keith.busch@intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 2/3] nvme: Pass pointers, not dma addresses, to nvme_get/set_features()
Date: Fri, 16 Sep 2016 09:34:12 -0600 [thread overview]
Message-ID: <f454464c-3afb-f151-69c2-1634f0b28545@fb.com> (raw)
In-Reply-To: <CALCETrVr2hTd=-gX8oVSL_AR3WX1rpp9B+9EXswE7c1J6rF8FA@mail.gmail.com>
On 09/16/2016 09:13 AM, Andy Lutomirski wrote:
> On Sep 16, 2016 1:41 AM, "Christoph Hellwig" <hch@lst.de> wrote:
>>
>> On Thu, Sep 15, 2016 at 10:24:20PM -0700, Andy Lutomirski wrote:
>>> Any user I can imagine that needs a buffer at all will want to pass
>>> a pointer directly. There are no currently callers that use
>>> buffers, so this change is painless, and it will make it much easier
>>> to start using features that use buffers (e.g. APST).
>>>
>>> Signed-off-by: Andy Lutomirski <luto@kernel.org>
>>> ---
>>
>> Looks good mostly good, but a nitpick below:
>>
>>> + /*
>>> + * Casting buffer to void* is safe here: __nvme_submit_sync_cmd knows
>>> + * that we're writing because it decodes the opcode.
>>> + */
>>> + ret = __nvme_submit_sync_cmd(dev->admin_q, &c, &cqe,
>>> + (void *)buffer, buflen, 0, NVME_QID_ANY, 0, 0);
>>
>> Cant we just drop the const annotation to avoid these casts?
>>
>
> Then we'd have nvme_set_feature() taking a non-const pointer, which
> would seem a little bit silly to me and might require the same cast
> somewhere else down the road.
That'd still be a lot cleaner than the cast, which needs a comment to
explain why it's supposedly safe. Just drop the const, imho.
--
Jens Axboe
next prev parent reply other threads:[~2016-09-16 15:35 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-16 5:24 [PATCH v3 0/3] nvme power saving Andy Lutomirski
2016-09-16 5:24 ` [PATCH v3 1/3] nvme/scsi: Remove power management support Andy Lutomirski
2016-09-16 8:33 ` Christoph Hellwig
2016-09-16 14:33 ` Keith Busch
2016-09-16 14:25 ` Christoph Hellwig
2016-09-19 7:59 ` Johannes Thumshirn
2016-09-16 23:33 ` J Freyensee
2016-09-16 5:24 ` [PATCH v3 2/3] nvme: Pass pointers, not dma addresses, to nvme_get/set_features() Andy Lutomirski
2016-09-16 8:41 ` Christoph Hellwig
2016-09-16 15:13 ` Andy Lutomirski
2016-09-16 15:34 ` Jens Axboe [this message]
2016-09-16 5:24 ` [PATCH v3 3/3] nvme: Enable autonomous power state transitions Andy Lutomirski
2016-09-16 8:42 ` Christoph Hellwig
2016-09-16 15:14 ` Andy Lutomirski
2016-09-16 16:51 ` Christoph Hellwig
2016-09-16 15:38 ` Keith Busch
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=f454464c-3afb-f151-69c2-1634f0b28545@fb.com \
--to=axboe@fb.com \
--cc=hch@lst.de \
--cc=james_p_freyensee@linux.intel.com \
--cc=keith.busch@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=luto@amacapital.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®