diff options
Diffstat (limited to 'src/include/device')
-rw-r--r-- | src/include/device/i2c.h | 15 | ||||
-rw-r--r-- | src/include/device/path.h | 33 |
2 files changed, 20 insertions, 28 deletions
diff --git a/src/include/device/i2c.h b/src/include/device/i2c.h index b3a5ccadd5..6115bd15e8 100644 --- a/src/include/device/i2c.h +++ b/src/include/device/i2c.h @@ -32,8 +32,7 @@ enum i2c_address_mode { I2C_MODE_10_BIT }; -struct i2c_seg -{ +struct i2c_seg { int read; uint8_t chip; uint8_t *buf; @@ -89,8 +88,10 @@ static inline int i2c_transfer(unsigned int bus, struct i2c_seg *segments, static inline int i2c_read_raw(unsigned int bus, uint8_t chip, uint8_t *data, int len) { - struct i2c_seg seg = - { .read = 1, .chip = chip, .buf = data, .len = len }; + struct i2c_seg seg = { + .read = 1, .chip = chip, .buf = data, .len = len + }; + return i2c_transfer(bus, &seg, 1); } @@ -102,8 +103,10 @@ static inline int i2c_read_raw(unsigned int bus, uint8_t chip, uint8_t *data, static inline int i2c_write_raw(unsigned int bus, uint8_t chip, uint8_t *data, int len) { - struct i2c_seg seg = - { .read = 0, .chip = chip, .buf = data, .len = len }; + struct i2c_seg seg = { + .read = 0, .chip = chip, .buf = data, .len = len + }; + return i2c_transfer(bus, &seg, 1); } diff --git a/src/include/device/path.h b/src/include/device/path.h index 1eaa32fb57..5109fdaec3 100644 --- a/src/include/device/path.h +++ b/src/include/device/path.h @@ -38,35 +38,29 @@ enum device_path_type { "DEVICE_PATH_SPI", \ } -struct domain_path -{ +struct domain_path { unsigned int domain; }; -struct pci_path -{ +struct pci_path { unsigned int devfn; }; -struct pnp_path -{ +struct pnp_path { unsigned int port; unsigned int device; }; -struct i2c_path -{ +struct i2c_path { unsigned int device; unsigned int mode_10bit; }; -struct spi_path -{ +struct spi_path { unsigned int cs; }; -struct apic_path -{ +struct apic_path { unsigned int apic_id; unsigned int package_id; unsigned int node_id; @@ -74,28 +68,23 @@ struct apic_path unsigned int thread_id; }; -struct ioapic_path -{ +struct ioapic_path { unsigned int ioapic_id; }; -struct cpu_cluster_path -{ +struct cpu_cluster_path { unsigned int cluster; }; -struct cpu_path -{ +struct cpu_path { unsigned int id; }; -struct cpu_bus_path -{ +struct cpu_bus_path { unsigned int id; }; -struct generic_path -{ +struct generic_path { unsigned int id; unsigned int subid; }; |