From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Subject: Re: [RFC PATCH 06/10] usb: xhci: Add Tegra XHCI host-controller driver Date: Thu, 15 May 2014 15:30:06 +0200 Message-ID: <11038777.juA2AddEko@wuerfel> References: <1400113986-339-1-git-send-email-abrestic@chromium.org> <15599140.PsD4j7x3tZ@wuerfel> <20140515091938.GD6434@ulmo> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Return-path: In-Reply-To: <20140515091938.GD6434@ulmo> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Thierry Reding Cc: Andrew Bresticker , linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Stephen Warren , Russell King , Peter De Schrijver , Prashant Gaikwad , Mike Turquette , Kishon Vijay Abraham I , Greg Kroah-Hartman , Mathias Nyman , Grant Likely , Randy Dunlap List-Id: devicetree@vger.kernel.org On Thursday 15 May 2014 11:19:40 Thierry Reding wrote: > > > + > > > + xhci = platform_device_alloc("xhci-hcd", PLATFORM_DEVID_AUTO); > > > + if (!xhci) { > > > + dev_err(dev, "Failed to allocate XHCI host\n"); > > > + ret = -ENOMEM; > > > + goto out; > > > + } > > > > This does not feel appropriate at all: Rather than creating a child device, > > you should have a specific driver that hooks into functions exported > > by the xhci core. See Documentation/driver-model/design-patterns.txt > > I don't think Documentation/driver-model/design-patterns.txt documents > this. Perhaps this is what you had in mind? > > http://lwn.net/Articles/336262/ No, I did mean Documentation/driver-model/design-patterns.txt. The pattern used in the proposed driver is to create the generic platform_device as the child of the more specific platform_device. The normal pattern is to have only one device and embed the generic structure inside of the more specific structure and use container_of to cast between the two as needed. Arnd -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html