Hi, On Fri, Dec 11, 2015 at 2:57 AM, Danny Milosavljevic <dan...@scratchpost.org> wrote: > Hi Maxime, > >> There's no need to have two at the same time, they're mutually >> exclusive. > > Hmmm. I don't understand it properly then... > Let's say two different compatibles in two different device tree nodes > match the same module on the same computer. > Will that module's probe() function be entered and left twice in that case? > If so, will the pdev differ?
In simplified terms, a pdev is created for each device node. For each pdev that has a matching driver, the driver's probe function is entered. So yes, a drivers probe function can be run multiple times, which is often the case for USB hosts, MMC controllers, any thing a system has multiple instances of. (Hence it is not a good idea to use global variables within a driver.) Once a driver successfully probes (probe function returns 0), the driver core considers the device "bound", and will not attempt to match other drivers. > > (I know that for our current hardware it's not possible for that to happen > in the first place, but I mean in general) > >> 2) make the "sun4i-codec" kernel module register two different codecs >> with two different compatibles and two different "sun4i"_codec_widget >> variables. >> 4) Copy the structure in probe and modify the copied instance >> >> I guess 2 or 4 are the two valid way of doing things. > > Yeah, in v6 I did some combination of 2 and 4 (if you squint) which turned > out quite nice. > Please check whether it's safe that way (if you have the time). If everything is known beforehand, having 2 separate read only tables is probably better. No need for maintainers / reviewers to squint. :) Regards ChenYu -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.