Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751238AbdHCOxo (ORCPT ); Thu, 3 Aug 2017 10:53:44 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:35523 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751010AbdHCOxm (ORCPT ); Thu, 3 Aug 2017 10:53:42 -0400 Date: Thu, 3 Aug 2017 16:53:37 +0200 From: Johan Hovold To: Robin Murphy Cc: Johan Hovold , Alan Stern , Christoph Hellwig , Marek Szyprowski , Greg Kroah-Hartman , Andreas =?iso-8859-1?Q?F=E4rber?= , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, stable , Sricharan R , Stefan Wahren Subject: Re: [PATCH v2] dma-mapping: skip USB devices when configuring DMA during probe Message-ID: <20170803145337.GW30136@localhost> References: <20170803131444.4101-1-johan@kernel.org> <20170803142308.GU30136@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1349 Lines: 39 On Thu, Aug 03, 2017 at 03:48:06PM +0100, Robin Murphy wrote: > On 03/08/17 15:23, Johan Hovold wrote: > > On Thu, Aug 03, 2017 at 10:04:21AM -0400, Alan Stern wrote: > >> On Thu, 3 Aug 2017, Johan Hovold wrote: > >>> diff --git a/include/linux/usb.h b/include/linux/usb.h > >>> index cb9fbd54386e..f86ad9d8c756 100644 > >>> --- a/include/linux/usb.h > >>> +++ b/include/linux/usb.h > >>> @@ -1222,6 +1222,11 @@ struct usb_device_driver { > >>> > >>> extern struct bus_type usb_bus_type; > >>> > >>> +static inline bool dev_is_usb(struct device *dev) > >>> +{ > >>> + return dev->bus == &usb_bus_type; > >>> +} > >>> + > >> > >> Will this work if the USB subsystem is built as a module? > > > > Nope. :-/ > > Oh bum, I hadn't even realised usb_bus_type could be modular. > > > Add another flag (e.g. skip_dma_configure) to struct device for now? > > Would it be sufficient to look for dev->of_node_reused, or is it also > possible for USB devices to have OF nodes of their own such that > of_dma_configure() would still blat the mask with a 32-bit default? > (Although that would still un-break Rpi3, even if strictly wrong) Yes, USB devices can have their own OF nodes so of_node_reused would not prevent of_dma_configure() from being called for them. But testing against the platform bus instead of not-USB should do the trick. Johan