Page MenuHomeFreeBSD

dwmmc: cleanup cmd and locking, consistency between mmc and mmccam
ClosedPublic

Authored by bz on Tue, Jul 29, 8:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Aug 19, 9:24 PM
Unknown Object (File)
Sun, Aug 17, 9:51 AM
Unknown Object (File)
Sat, Aug 16, 8:48 PM
Unknown Object (File)
Sat, Aug 16, 6:30 PM
Unknown Object (File)
Fri, Aug 15, 8:34 AM
Unknown Object (File)
Thu, Aug 14, 2:45 AM
Unknown Object (File)
Tue, Aug 12, 3:52 AM
Unknown Object (File)
Mon, Aug 4, 7:32 PM
Subscribers

Details

Summary

In general sprinkle locking assertions and harmonized KASSERTs
throughout the upper part of the driver to document expectations.

In dwmmc_cmd_done() "cmd" should be set correctly and be used for
both MMCCAM and classic mmc rather than special-casing mmccam.
In dwmmc_next_operation() place variable declarations on the top
for both cases before the first debug and lock assertion calls;
then factor out common parts at the end and put both cases in the
same order.
By calling dwmmc_next_operation() directly from both dwmmc_request()
in the mmc case, and dwmmc_cam_request() in the mmccase (rather than)
chaining calls in the latter, we avoid unlocking the sc in the mmccam
case and have a consistent call path from both; also removing the
mmccam #ifdef from dwmmc_request() brings more clarity.
In dwmmc_next_operation() enhance the panic/error messages with
some extra information and assert that we come in with a cam pinfo
on CAM_ACTIVE_INDEX.

MFC after: 3 days

Test Plan

@imp, while I believe this to be true, we should never
end up here not on CAM_ACTIVE_INDEX as the KASSERT
documents, right?

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 65841
Build 62724: arc lint + arc unit

Event Timeline

bz requested review of this revision.Tue, Jul 29, 8:13 PM
bz created this revision.
This revision is now accepted and ready to land.Wed, Jul 30, 6:02 AM

This change looks good, I say belatedly. the one suggestion is really kinda weak and mostly super-duper paranoia that other drivers don't do...

sys/dev/mmc/host/dwmmc.c
1510

might want to assert this is a MMCIO, though that may be a bit much