eeprom93xx: fix coding style

scripts/checkpatch.pl reports about some style problems,
this commit fixes some of them:

ERROR: space prohibited before open square bracket '['
+    .fields      = (VMStateField []) {

ERROR: space prohibited after that '!' (ctx:BxW)
+    if (! eeprom->eecs && eecs) {
         ^

ERROR: space prohibited after that '!' (ctx:WxW)
+    } else if (eeprom->eecs && ! eecs) {
                                ^

ERROR: space prohibited after that '!' (ctx:WxW)
+    } else if (eecs && ! eeprom->eesk && eesk) {
                        ^

ERROR: switch and case should be at the same indent
                     switch (address >> (eeprom->addrbits - 2)) {
+                        case 0:
[...]
+                        case 1:
[...]
+                        case 2:
[...]
+                        case 3:

ERROR: return is not a function, parentheses are not required
+    return (eeprom->eedo);

ERROR: switch and case should be at the same indent
     switch (nwords) {
+        case 16:
+        case 64:
[...]
+        case 128:
+        case 256:
[...]
+        default:

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Cc: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Cc: qemu-trivial@nongnu.org
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
Antony Pavlov 2013-12-04 10:27:29 +04:00 committed by Michael Tokarev
parent a6b6d08a3b
commit 6fedcaa1c5

View File

@ -126,7 +126,7 @@ static const VMStateDescription vmstate_eeprom = {
.version_id = EEPROM_VERSION, .version_id = EEPROM_VERSION,
.minimum_version_id = OLD_EEPROM_VERSION, .minimum_version_id = OLD_EEPROM_VERSION,
.minimum_version_id_old = OLD_EEPROM_VERSION, .minimum_version_id_old = OLD_EEPROM_VERSION,
.fields = (VMStateField []) { .fields = (VMStateField[]) {
VMSTATE_UINT8(tick, eeprom_t), VMSTATE_UINT8(tick, eeprom_t),
VMSTATE_UINT8(address, eeprom_t), VMSTATE_UINT8(address, eeprom_t),
VMSTATE_UINT8(command, eeprom_t), VMSTATE_UINT8(command, eeprom_t),
@ -157,13 +157,13 @@ void eeprom93xx_write(eeprom_t *eeprom, int eecs, int eesk, int eedi)
logout("CS=%u SK=%u DI=%u DO=%u, tick = %u\n", logout("CS=%u SK=%u DI=%u DO=%u, tick = %u\n",
eecs, eesk, eedi, eedo, tick); eecs, eesk, eedi, eedo, tick);
if (! eeprom->eecs && eecs) { if (!eeprom->eecs && eecs) {
/* Start chip select cycle. */ /* Start chip select cycle. */
logout("Cycle start, waiting for 1st start bit (0)\n"); logout("Cycle start, waiting for 1st start bit (0)\n");
tick = 0; tick = 0;
command = 0x0; command = 0x0;
address = 0x0; address = 0x0;
} else if (eeprom->eecs && ! eecs) { } else if (eeprom->eecs && !eecs) {
/* End chip select cycle. This triggers write / erase. */ /* End chip select cycle. This triggers write / erase. */
if (eeprom->writable) { if (eeprom->writable) {
uint8_t subcommand = address >> (eeprom->addrbits - 2); uint8_t subcommand = address >> (eeprom->addrbits - 2);
@ -189,7 +189,7 @@ void eeprom93xx_write(eeprom_t *eeprom, int eecs, int eesk, int eedi)
} }
/* Output DO is tristate, read results in 1. */ /* Output DO is tristate, read results in 1. */
eedo = 1; eedo = 1;
} else if (eecs && ! eeprom->eesk && eesk) { } else if (eecs && !eeprom->eesk && eesk) {
/* Raising edge of clock shifts data in. */ /* Raising edge of clock shifts data in. */
if (tick == 0) { if (tick == 0) {
/* Wait for 1st start bit. */ /* Wait for 1st start bit. */
@ -230,20 +230,20 @@ void eeprom93xx_write(eeprom_t *eeprom, int eecs, int eesk, int eedi)
if (command == 0) { if (command == 0) {
/* Command code in upper 2 bits of address. */ /* Command code in upper 2 bits of address. */
switch (address >> (eeprom->addrbits - 2)) { switch (address >> (eeprom->addrbits - 2)) {
case 0: case 0:
logout("write disable command\n"); logout("write disable command\n");
eeprom->writable = 0; eeprom->writable = 0;
break; break;
case 1: case 1:
logout("write all command\n"); logout("write all command\n");
break; break;
case 2: case 2:
logout("erase all command\n"); logout("erase all command\n");
break; break;
case 3: case 3:
logout("write enable command\n"); logout("write enable command\n");
eeprom->writable = 1; eeprom->writable = 1;
break; break;
} }
} else { } else {
/* Read, write or erase word. */ /* Read, write or erase word. */
@ -276,7 +276,7 @@ uint16_t eeprom93xx_read(eeprom_t *eeprom)
{ {
/* Return status of pin DO (0 or 1). */ /* Return status of pin DO (0 or 1). */
logout("CS=%u DO=%u\n", eeprom->eecs, eeprom->eedo); logout("CS=%u DO=%u\n", eeprom->eecs, eeprom->eedo);
return (eeprom->eedo); return eeprom->eedo;
} }
#if 0 #if 0
@ -296,18 +296,18 @@ eeprom_t *eeprom93xx_new(DeviceState *dev, uint16_t nwords)
uint8_t addrbits; uint8_t addrbits;
switch (nwords) { switch (nwords) {
case 16: case 16:
case 64: case 64:
addrbits = 6; addrbits = 6;
break; break;
case 128: case 128:
case 256: case 256:
addrbits = 8; addrbits = 8;
break; break;
default: default:
assert(!"Unsupported EEPROM size, fallback to 64 words!"); assert(!"Unsupported EEPROM size, fallback to 64 words!");
nwords = 64; nwords = 64;
addrbits = 6; addrbits = 6;
} }
eeprom = (eeprom_t *)g_malloc0(sizeof(*eeprom) + nwords * 2); eeprom = (eeprom_t *)g_malloc0(sizeof(*eeprom) + nwords * 2);