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)
Oct 16 2024, 9:30 PM
Unknown Object (File)
Oct 9 2024, 7:08 AM
Unknown Object (File)
Sep 30 2024, 12:26 AM
Unknown Object (File)
Sep 23 2024, 4:35 AM
Unknown Object (File)
Sep 20 2024, 2:30 AM
Unknown Object (File)
Sep 18 2024, 7:46 AM
Unknown Object (File)
Sep 8 2024, 7:21 PM
Unknown Object (File)
Sep 8 2024, 1:43 AM
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.