From: Eli Billauer <eli.billauer@gmail.com>
To: Tejun Heo <tj@kernel.org>
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: Sat, 17 May 2014 15:19:21 +0300 [thread overview]
Message-ID: <537753C9.3060101@gmail.com> (raw)
In-Reply-To: <20140516210805.GO5379@htj.dyndns.org>
Hello Tejun,
On 17/05/14 00:08, Tejun Heo wrote:
>
> Don't we wanna map the underlying operation - dma_map_single_attrs() -
> instead?
>
I'll resubmit this patch promptly, with a follow-up patch for the diff
to implement dmam_map_single_attrs() instead. Plus a define-statement
for dmam_map_single(). I can't test the case of a non-NULL value for
@attrs however.
>
>> + if (dma_mapping_error(dev, dma_handle)) {
>> + devres_free(dr);
>> + return 0;
>>
> Can't we just keep returning dma_handle? Even if that means invoking
> ->mapping_error() twice? It's yucky to have subtly different error
> return especially because in most cases it won't fail.
>
Yucky it is indeed. There are however two problems with keeping the
existing API:
* What to do if devres_alloc() fails. How do I signal back an error? The
only way I can think of is returning zero. But if the caller should know
that zero means failure, I've already broken the API. I might as well
return zero for any kind of failure.
* It seems like a lot of dma_mapping_error() implementations always
return no-error, since the DMA mapping can't fail on specific
architectures. If callers use dma_mapping_error(), the possible
devres_alloc() failure will be missed.
By the way, where I've seen dma_mapping_error() doing something, it
checks for dma_handle == 0.
Submitting updated patches for the DMA mapping part soon.
Regards,
Eli
next prev parent reply other threads:[~2014-05-17 12:35 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 [this message]
2014-05-19 20:17 ` Tejun Heo
2014-05-20 5:54 ` Eli Billauer
2014-05-20 15:05 ` Tejun Heo
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=537753C9.3060101@gmail.com \
--to=eli.billauer@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@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