mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-16 06:52:27 +00:00
cam_periph: switch from negative logic to positive logic
When scanning the resources that are wired for this driver, skip any that whose number doesn't match newunit. They aren't relevant. Switch to positive logic to break out of the loop (and thus go to the next unit) if we find either a target resource or an at resource. This makes the code easier to read and modify. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D32681
This commit is contained in:
parent
00f79c97a4
commit
bee0133fb9
|
@ -579,11 +579,11 @@ camperiphnextunit(struct periph_driver *p_drv, u_int newunit, int wired,
|
||||||
r = resource_find_dev(&i, dname, &dunit, NULL, NULL);
|
r = resource_find_dev(&i, dname, &dunit, NULL, NULL);
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
break;
|
break;
|
||||||
/* if no "target" and no specific scbus, skip */
|
|
||||||
if (resource_int_value(dname, dunit, "target", &val) &&
|
if (newunit != dunit)
|
||||||
resource_string_value(dname, dunit, "at",&strval))
|
|
||||||
continue;
|
continue;
|
||||||
if (newunit == dunit)
|
if (resource_int_value(dname, dunit, "target", &val) == 0 ||
|
||||||
|
resource_string_value(dname, dunit, "at", &strval) == 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
|
|
Loading…
Reference in a new issue