lkml.org 
[lkml]   [2014]   [May]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC PATCH 06/10] usb: xhci: Add Tegra XHCI host-controller driver
Date
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


\
 
 \ /
  Last update: 2014-05-15 16:01    [W:0.103 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site