From: Tejun Heo <tj@kernel.org>
To: Eli Billauer <eli.billauer@gmail.com>
Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] dma-mapping: Add devm_ interface for dma_map_single()
Date: Tue, 20 May 2014 11:05:54 -0400 [thread overview]
Message-ID: <20140520150554.GF2804@htj.dyndns.org> (raw)
In-Reply-To: <537AEE01.20602@gmail.com>
Hello,
On Tue, May 20, 2014 at 08:54:09AM +0300, Eli Billauer wrote:
> That seems OK to me, but the problem I'm concerned with is this: In
> devm_get_free_pages() it says
>
> devres = devres_alloc(devm_pages_release,
> sizeof(struct pages_devres), GFP_KERNEL);
> if (unlikely(!devres)) {
> free_pages(addr, order);
> return 0;
> }
>
> What should I put instead of this "return 0" to conform with the current
> API?
Ah, okay. No idea.
> And to make things even worse, on some architectures, dma_mapping_error()
> always returns success, regardless of dma_handle. So if we stick to the
> current API, the caller of devm_get_free_pages() will never know it failed
> on these architectures.
>
> So my conclusion was that the caller must be aware that if
> devm_get_free_pages() returns zero it's an error, regardless of
> dma_mapping_error(). That breaks the API. Once it's broken, why not return
> zero on all possible errors?
What if 0 is a valid return for the architecture? Isn't that the
whole point of dma_mapping_error() interface? Maybe the right thing
to do is using a separate out argument for dma_handle?
int dmam_map_single(blah blah, dma_addr_t *out_addr);
So that it can return -errno like other non-crazy functions? We'll
probably ask somebody who knows this code better.
Thanks.
--
tejun
next prev parent reply other threads:[~2014-05-20 15:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-16 8:26 [PATCH 0/5] devres: Add functions + migrate Xillybus driver Eli Billauer
2014-05-16 8:26 ` [PATCH 1/5] devres: Add devm_get_free_pages API Eli Billauer
2014-05-16 21:01 ` Tejun Heo
2014-05-16 8:26 ` [PATCH 2/5] dma-mapping: Add devm_ interface for dma_map_single() Eli Billauer
2014-05-16 21:08 ` Tejun Heo
2014-05-17 12:19 ` Eli Billauer
2014-05-19 20:17 ` Tejun Heo
2014-05-20 5:54 ` Eli Billauer
2014-05-20 15:05 ` Tejun Heo [this message]
2014-05-16 8:26 ` [PATCH 3/5] dma-mapping: pci: Add devm_ interface for pci_map_single Eli Billauer
2014-05-16 21:09 ` Tejun Heo
2014-05-16 8:26 ` [PATCH 4/5] staging: xillybus: Use devm_ API on probe and remove Eli Billauer
2014-05-16 8:26 ` [PATCH 5/5] staging: xillybus: Use devm_ API for memory allocation and DMA mapping Eli Billauer
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=20140520150554.GF2804@htj.dyndns.org \
--to=tj@kernel.org \
--cc=devel@driverdev.osuosl.org \
--cc=eli.billauer@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox