linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
To: Hiroshi Doyu <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linaro-mm-sig-cunTk1MwBs8s++Sfvej+rw@public.gmane.org,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [v2 1/1] ARM: dma-mapping: Call arm_dma_set_mask() if no ->set_dma_mask()
Date: Tue, 29 Jan 2013 13:47:26 +0100	[thread overview]
Message-ID: <5107C4DE.7060607@samsung.com> (raw)
In-Reply-To: <1359462438-21006-1-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

Hello,

On 1/29/2013 1:27 PM, Hiroshi Doyu wrote:
> struct dma_map_ops iommu_ops doesn't have ->set_dma_mask, which causes
> crash when dma_set_mask() is called from some driver.
>
> Signed-off-by: Hiroshi Doyu <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ---
>   arch/arm/include/asm/dma-mapping.h |   11 ++++++++---
>   1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
> index 5b579b9..63cc49c 100644
> --- a/arch/arm/include/asm/dma-mapping.h
> +++ b/arch/arm/include/asm/dma-mapping.h
> @@ -14,6 +14,7 @@
>   #define DMA_ERROR_CODE	(~0)
>   extern struct dma_map_ops arm_dma_ops;
>   extern struct dma_map_ops arm_coherent_dma_ops;
> +extern int arm_dma_set_mask(struct device *dev, u64 dma_mask);
>   
>   static inline struct dma_map_ops *get_dma_ops(struct device *dev)
>   {
> @@ -32,7 +33,13 @@ static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops)
>   
>   static inline int dma_set_mask(struct device *dev, u64 mask)
>   {
> -	return get_dma_ops(dev)->set_dma_mask(dev, mask);
> +	struct dma_map_ops *ops = get_dma_ops(dev);
> +	BUG_ON(!ops);
> +
> +	if (ops->set_dma_mask)
> +		return ops->set_dma_mask(dev, mask);
> +
> +	return arm_dma_set_mask(dev, mask);
>   }
>   
>   #ifdef __arch_page_to_dma
> @@ -112,8 +119,6 @@ static inline void dma_free_noncoherent(struct device *dev, size_t size,
>   
>   extern int dma_supported(struct device *dev, u64 mask);
>   
> -extern int arm_dma_set_mask(struct device *dev, u64 dma_mask);
> -
>   /**
>    * arm_dma_alloc - allocate consistent memory for DMA
>    * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices

It can be done much simpler, please just add '.set_dma_mask = 
arm_dma_set_mask,'
to iommu_ops declaration. There is no point complicating the header files.

Best regards
-- 
Marek Szyprowski
Samsung Poland R&D Center

  parent reply	other threads:[~2013-01-29 12:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5107B301.2060802@samsung.com>
     [not found] ` <5107B301.2060802-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-01-29 12:27   ` [v2 1/1] ARM: dma-mapping: Call arm_dma_set_mask() if no ->set_dma_mask() Hiroshi Doyu
     [not found]     ` <1359462438-21006-1-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-01-29 12:47       ` Marek Szyprowski [this message]
     [not found]         ` <5107C4DE.7060607-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-01-29 12:57           ` [v3 1/1] ARM: dma-mapping: Set arm_dma_set_mask() for iommu->set_dma_mask() Hiroshi Doyu

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=5107C4DE.7060607@samsung.com \
    --to=m.szyprowski-sze3o3uu22jbdgjk7y7tuq@public.gmane.org \
    --cc=hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=linaro-mm-sig-cunTk1MwBs8s++Sfvej+rw@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.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;
as well as URLs for NNTP newsgroup(s).