[PATCH] powerpc/ps3: Set driver coherent_dma_mask

Alan Stern stern at rowland.harvard.edu
Fri Jul 20 00:33:10 AEST 2018


On Wed, 18 Jul 2018, Geoff Levand wrote:

> Set the coherent_dma_mask for the PS3 ehci, ohci, and snd devices.
> 
> Silences WARN_ON_ONCE messages emitted by the dma_alloc_attrs() routine.
> 
> Reported-by: Fredrik Noring <noring at nocrew.org>
> Signed-off-by: Geoff Levand <geoff at infradead.org>
> ---
> Hi Michael,
> 
> This just silences some warnings.  Can you take it through the powerpc
> tree?
> 
> -Geoff
> 
> 
>  drivers/usb/host/ehci-ps3.c | 6 ++++--
>  drivers/usb/host/ohci-ps3.c | 6 ++++--
>  sound/ppc/snd_ps3.c         | 5 +++++
>  3 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-ps3.c b/drivers/usb/host/ehci-ps3.c
> index 8c733492d8fe..454d8c624a3f 100644
> --- a/drivers/usb/host/ehci-ps3.c
> +++ b/drivers/usb/host/ehci-ps3.c
> @@ -86,7 +86,7 @@ static int ps3_ehci_probe(struct ps3_system_bus_device *dev)
>  	int result;
>  	struct usb_hcd *hcd;
>  	unsigned int virq;
> -	static u64 dummy_mask = DMA_BIT_MASK(32);
> +	static u64 dummy_mask;
>  
>  	if (usb_disabled()) {
>  		result = -ENODEV;
> @@ -131,7 +131,9 @@ static int ps3_ehci_probe(struct ps3_system_bus_device *dev)
>  		goto fail_irq;
>  	}
>  
> -	dev->core.dma_mask = &dummy_mask; /* FIXME: for improper usb code */
> +	dummy_mask = DMA_BIT_MASK(32);
> +	dev->core.dma_mask = &dummy_mask;
> +	dma_set_coherent_mask(&dev->core, dummy_mask);

What is the reason for changing a static initialization to a dynamic
one?  As far as I can see, the patch touches four lines of code but the
only real difference is addition of a single line (and removal of a 
comment).

> diff --git a/drivers/usb/host/ohci-ps3.c b/drivers/usb/host/ohci-ps3.c
> index 20a23d795adf..395f9d3bc849 100644
> --- a/drivers/usb/host/ohci-ps3.c
> +++ b/drivers/usb/host/ohci-ps3.c
> @@ -69,7 +69,7 @@ static int ps3_ohci_probe(struct ps3_system_bus_device *dev)
>  	int result;
>  	struct usb_hcd *hcd;
>  	unsigned int virq;
> -	static u64 dummy_mask = DMA_BIT_MASK(32);
> +	static u64 dummy_mask;
>  
>  	if (usb_disabled()) {
>  		result = -ENODEV;
> @@ -115,7 +115,9 @@ static int ps3_ohci_probe(struct ps3_system_bus_device *dev)
>  		goto fail_irq;
>  	}
>  
> -	dev->core.dma_mask = &dummy_mask; /* FIXME: for improper usb code */
> +	dummy_mask = DMA_BIT_MASK(32);
> +	dev->core.dma_mask = &dummy_mask;
> +	dma_set_coherent_mask(&dev->core, dummy_mask);

Same here.

Alan Stern



More information about the Linuxppc-dev mailing list