Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752572AbbHSV3H (ORCPT ); Wed, 19 Aug 2015 17:29:07 -0400 Received: from mail-ob0-f182.google.com ([209.85.214.182]:34538 "EHLO mail-ob0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751768AbbHSV3F (ORCPT ); Wed, 19 Aug 2015 17:29:05 -0400 MIME-Version: 1.0 In-Reply-To: <1643536.i8Q5EFEN01@wuerfel> References: <20150808092252.GJ7557@n2100.arm.linux.org.uk> <1643536.i8Q5EFEN01@wuerfel> From: Duc Dang Date: Wed, 19 Aug 2015 14:28:33 -0700 Message-ID: Subject: Re: [PATCH v5 1/2] usb: make xhci platform driver use 64 bit or 32 bit DMA To: Arnd Bergmann Cc: linux-arm , Russell King - ARM Linux , Feng Kan , Mark Langsdorf , mathias.nyman@intel.com, Greg KH , USB list , patches , Linux Kernel Mailing List , Loc Ho Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1835 Lines: 50 On Sat, Aug 15, 2015 at 1:05 PM, Arnd Bergmann wrote: > > On Saturday 08 August 2015 13:31:02 Duc Dang wrote: > > > > > > If we know that pdev->dev.dma_mask will always be initialised at this > > > point, then the above change is fine. If not, it's introducing a > > > regression - dma_set_mask_and_coherent() will fail if pdev->dev.dma_mask > > > is NULL (depending on the architectures implementation of dma_set_mask()). > > > > > > Prefixing the above change with the two lines I mention above would > > > ensure equivalent behaviour. Even if we do want to get rid of this, > > > I'd advise to do it as a separate patch after this change, which can > > > be independently reverted if there's problems with its removal. > > > > > Hi Russell, > > > > I will add the 2 lines you mentioned back to next version of the > > patch. It is safer to do it that way as I do not see > > pdev->dev.dma_mask gets initialized before the call > > dma_set_mask_and_coherent inside this xhci_plat.c file. > > It would be good to add a WARN_ON() to the case where dma_mask > is a NULL pointer at the least. That way, we will at least > find out if there are some broken platforms that do not correctly > initialize the mask pointer. Hi Arnd, So the check will look like this, please let me know what do you think: if (!pdev->dev.dma_mask) { WARN_ON(1); /* Initialize dma_mask if the broken platform code has not done so */ pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; } > > Arnd -- Regards, Duc Dang. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/