Date: Fri, 21 Mar 2003 21:17:18 +0700 (ICT) From: John-Mark Gurney <gurney_j@resnet.uoregon.edu> To: dfr@freebsd.org, <hackers@freebsd.org> Subject: bug in subr_bus.c? Message-ID: <20030321204808.A65800-100000@resnet.uoregon.edu>
next in thread | raw e-mail | index | archive | help
Hello, It's been a while since I've been doing FreeBSD work, but I was recently working on a device driver for the Pinicle Micro DC10+ (Zoran chip) video en/decoder board and was making full use of the newbus system. I've been doing my devel work on 5.0-R (I'm in Thailand right now so I don't have my normal devel environment) and doing it all on KLD to help speed up devel. Right now the problem I have is on kldunload, devclass_delete_driver gets called and calls the detach routine for all associated devices. This is a slight problem since device_detach doesn't know anything about the children, and if you look at device_delete_child, it deletes all the children, and then calls detach. So, the driver can: a) delete it's own children, but if it gets removed via device_delete_child, this work is already down for you. b) let the bus code remove your children, but then if you're a kld, your children won't be removed and you will cause a panic in devinfo and other nasties since a device's parent won't exist anymore. I believe that devclass_delete_driver should do a device_delete_child instead of a simple detach, but then there is much code that is broken in that it assumes that it needs to delete it's own children. So, do we have the *_detach routine delete it's children or have the bus code do it? If you look at sys/dev/iicbus/iicbb.c, in the detach routine it delete's the iicbus child, but that would already be gone in the delete_child case, but not in the simple detach case. So, which is correct? I'll fix this, but I need direction on which way to go. I think that letting the bus code delete the children is better. Comments? btw, I will post some scripts to autoload kld debug symbols to my home page (http://people.freebsd.org/~jmg/) soon. John-Mark Gurney To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030321204808.A65800-100000>