Page MenuHomeFreeBSD

if_muge: move chip type detection into muge_attach
ClosedPublic

Authored by emaste on May 23 2018, 7:52 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 20 2024, 6:25 PM
Unknown Object (File)
Jan 3 2024, 7:43 AM
Unknown Object (File)
Dec 27 2023, 10:03 AM
Unknown Object (File)
Dec 27 2023, 10:03 AM
Unknown Object (File)
Oct 1 2023, 1:12 PM
Unknown Object (File)
Sep 17 2023, 1:17 AM
Unknown Object (File)
Aug 22 2023, 8:50 PM
Unknown Object (File)
Aug 2 2023, 6:06 PM
Subscribers

Details

Summary

Chip type detection was previously done in muge_attach_post, which happens after attach. We want the driver to instead fail to attach for unsupported devices.

(I'm not sure this is the best place for this code, but ue_attach_post isn't able to return an error and ue_attach_post_sub seems too late.)

Also replace call to muge_detach on failure with reverse teardown of only those setup tasks that have been performed.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

alternatively ue_attach_post could be made to return an error

sys/dev/usb/net/if_muge.c
2120 ↗(On Diff #42892)

Shouldn't this block be before uether_ifattach() else the post-attach will race with the reading of the revision register.

sys/dev/usb/net/if_muge.c
2120 ↗(On Diff #42892)

That panics in lan78xx_read_reg because it relies on something set up by uether_ifattach.

I see. I then suggest:

  1. add a flag to store the status from xxx_chip_init() into the softc.
  2. After err = uether_ifattach(ue); and the if(err) you add:

usb_proc_drain(&ue->ue_tq);
if (sc->someflag)
goto xxx_error;

Sorry, usb_proc_drain() won't work - it will kill the taskqueue. You'll need to use usb_proc_mwait().

This revision was not accepted when it landed; it landed in state Needs Review.May 24 2018, 4:34 PM
This revision was automatically updated to reflect the committed changes.

Thanks for rS334158 and the suggestion on the approach taken here.