mirror of
https://github.com/opnsense/src.git
synced 2026-04-24 07:37:25 -04:00
Errors are communicated between the i2c controller layer and upper layers (iicbus and slave device drivers) using a set of IIC_Exxxxxx constants which effectively define a private number space separate from (and having values that conflict with) the system errno number space. Sometimes it is necessary to report a plain old system error (especially EINTR) from the controller or bus layer and have that value make it back across the syscall interface intact. I initially considered replicating a few "crucial" errno values with similar names and new numbers, e.g., IIC_EINTR, IIC_ERESTART, etc. It seemed like that had the potential to grow over time until many of the errno names were duplicated into the IIC_Exxxxx space. So instead, this defines a mechanism to "encode" an errno into the IIC_Exxxx space by setting the high bit and putting the errno into the lower-order bits; a new errno2iic() function does this. The existing iic2errno() recognizes the encoded values and extracts the original errno out of the encoded value. An interesting wrinkle occurs with the pseudo-error values such as ERESTART -- they aleady have the high bit set, and turning it off would be the wrong thing to do. Instead, iic2errno() recognizes that lots of high bits are on (i.e., it's a negative number near to zero) and just returns that value as-is. Thus, existing drivers continue to work without needing any changes, and there is now a way to return errno values from the lower layers. The first use of that is in iicbus_poll() which does mtx_sleep() with the PCATCH flag, and needs to return the errno from that up the call chain. Differential Revision: https://reviews.freebsd.org/D20975 |
||
|---|---|---|
| .. | ||
| twsi | ||
| ad7417.c | ||
| ad7418.c | ||
| adm1030.c | ||
| ads111x.c | ||
| adt746x.c | ||
| ds13rtc.c | ||
| ds1307.c | ||
| ds1307reg.h | ||
| ds1631.c | ||
| ds1672.c | ||
| ds1775.c | ||
| ds3231.c | ||
| ds3231reg.h | ||
| icee.c | ||
| if_ic.c | ||
| iic.c | ||
| iic.h | ||
| iic_recover_bus.c | ||
| iic_recover_bus.h | ||
| iicbb.c | ||
| iicbb_if.m | ||
| iicbus.c | ||
| iicbus.h | ||
| iicbus_if.m | ||
| iicoc.c | ||
| iicoc.h | ||
| iiconf.c | ||
| iiconf.h | ||
| iicsmb.c | ||
| isl12xx.c | ||
| lm75.c | ||
| max6690.c | ||
| nxprtc.c | ||
| ofw_iicbus.c | ||
| rtc8583.c | ||
| s35390a.c | ||
| sy8106a.c | ||
| syr827.c | ||