Page MenuHomeFreeBSD

Create new wrapper function: bus_delayed_attach_children()

Authored by imp on Aug 29 2019, 3:29 PM.



Delay the attachment of children, when requested, until after interrutps are
running. This is often needed to allow children to run transactions on i2c or
spi busses. It's a common enough idiom that it will be useful to have its own

Diff Detail

rS FreeBSD src repository - subversion
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

3757 ↗(On Diff #61458)

s/smbus/child bus/

From IRC this morning:
[09:40:36] <DamnHippi> bsdimp: I like the idea. I sure wish there was a way to get the relationship to interrupts or intr config hooks into the name (but the name is already pretty long).
[09:41:17] <bsdimp> I struggled with the name as well...
[09:41:34] <bsdimp> bus_delayed_attach(dev, BUS_INTR);
[09:41:43] <bsdimp> was the second choice I had to have a mask of things that you delay it for.
[09:41:46] <DamnHippi> hmmm, interesting.
[09:42:03] <bsdimp> but then that isn't just the children, etc
[09:42:12] <DamnHippi> there was another change pending having to do with delaying attachment.
[09:42:17] <bsdimp> so I went with the simple, but I'm open to something more generic
[09:42:23] <DamnHippi> hang on a sec
[09:42:25] <bsdimp> BUS_NEWDEV
[09:42:39] <bsdimp> or whatever so that nathanw's ideas could be done this way too.
[09:42:54] <bsdimp> The device is partially attach, and finishes attaching when the right device(s) appear.
[09:43:15] <DamnHippi>
[09:43:41] <bsdimp> yea, that's the one. I love the idea, and hate how he did it.
[09:43:48] <DamnHippi> I haven't even looked at it, just saw it mentioned the other day.
[09:43:51] <bsdimp> and was looking for a better way.
[09:43:56] <bsdimp> and this may be it.
[09:44:42] <DamnHippi> but I can't sidetrack into this in depth right now, I'm kinda slammed at $work.
[09:44:43] <bsdimp> It's more similar to config_intrhook() than this though. config_dependend_device_now_here() but you can't have a device_t to pass to it because that device doesn't exist :)
[09:45:16] <bsdimp> DamnHippi works for me. lemme think about your feedback and we'll chat tomorrow. I have a couple of weekend tests I want to run and I gotta get them setup.

This revision was not accepted when it landed; it landed in state Needs Review.Dec 13 2019, 7:39 PM
This revision was automatically updated to reflect the committed changes.