aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/smbios/smbios.c
diff options
context:
space:
mode:
authorMarvin Borner2020-03-18 17:32:50 +0100
committerMarvin Borner2020-03-18 17:32:50 +0100
commitf495cc1e93710c233292a503720ec235a61b685c (patch)
tree23b0b4b82b6d80001c1ffdb15f00b93cbdc65722 /src/kernel/smbios/smbios.c
parentc6657aac0c5d5ecf347bc082cb6df38e1174d297 (diff)
Applied official linux kernel code style guidelines
Due to my change to vim and the clang-format plugin this was needed!
Diffstat (limited to 'src/kernel/smbios/smbios.c')
-rw-r--r--src/kernel/smbios/smbios.c62
1 files changed, 33 insertions, 29 deletions
diff --git a/src/kernel/smbios/smbios.c b/src/kernel/smbios/smbios.c
index 2e60f6b..748a2a6 100644
--- a/src/kernel/smbios/smbios.c
+++ b/src/kernel/smbios/smbios.c
@@ -6,44 +6,48 @@ struct smbios_entry *smbios = 0;
size_t smbios_table_len(struct smbios_header *header)
{
- size_t i;
- const char *strtab = (char *) header + header->length;
- for (i = 1; strtab[i - 1] != '\0' || strtab[i] != '\0'; i++);
- return header->length + i + 1;
+ size_t i;
+ const char *strtab = (char *)header + header->length;
+ for (i = 1; strtab[i - 1] != '\0' || strtab[i] != '\0'; i++)
+ ;
+ return header->length + i + 1;
}
struct smbios_entry *get_smbios()
{
- if (smbios != 0) return smbios;
+ if (smbios != 0)
+ return smbios;
- char *mem = (char *) 0xF0000;
- int length, i;
- unsigned char checksum;
- while ((unsigned int) mem < 0x100000) {
- if (mem[0] == '_' && mem[1] == 'S' && mem[2] == 'M' && mem[3] == '_') {
- length = mem[5];
- checksum = 0;
- for (i = 0; i < length; i++) {
- checksum += mem[i];
- }
- if (checksum == 0) break;
- }
- mem += 16;
- }
+ char *mem = (char *)0xF0000;
+ int length, i;
+ unsigned char checksum;
+ while ((unsigned int)mem < 0x100000) {
+ if (mem[0] == '_' && mem[1] == 'S' && mem[2] == 'M' && mem[3] == '_') {
+ length = mem[5];
+ checksum = 0;
+ for (i = 0; i < length; i++) {
+ checksum += mem[i];
+ }
+ if (checksum == 0)
+ break;
+ }
+ mem += 16;
+ }
- if ((unsigned int) mem == 0x100000) {
- warn("No SMBIOS found!");
- return 0;
- }
+ if ((unsigned int)mem == 0x100000) {
+ warn("No SMBIOS found!");
+ return 0;
+ }
- smbios = (struct smbios_entry *) mem;
- if (smbios->major_version != 2) warn("Non-supported SMBIOS version");
- smbios_table((struct smbios_header *) mem);
- return smbios;
+ smbios = (struct smbios_entry *)mem;
+ if (smbios->major_version != 2)
+ warn("Non-supported SMBIOS version");
+ smbios_table((struct smbios_header *)mem);
+ return smbios;
}
void smbios_table(struct smbios_header *header)
{
- // struct smbios_0 *table = (struct smbios_0 *) (header + sizeof(struct smbios_header));
- // serial_printf("\n\n %d", table->bios_version);
+ // struct smbios_0 *table = (struct smbios_0 *) (header + sizeof(struct smbios_header));
+ // serial_printf("\n\n %d", table->bios_version);
}