aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAntony Pavlov <antonynpavlov@gmail.com>2013-12-04 10:27:29 +0400
committerMichael Tokarev <mjt@tls.msk.ru>2013-12-06 22:56:51 +0400
commit6fedcaa1c5419fa89c31fd34dabbd71861c615d2 (patch)
tree1c0ca834d9097a7f889385166d4eefc49a7de0af /hw
parenta6b6d08a3bf93c8cc6521336a89ac0467ab7edca (diff)
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>
Diffstat (limited to 'hw')
-rw-r--r--hw/nvram/eeprom93xx.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/hw/nvram/eeprom93xx.c b/hw/nvram/eeprom93xx.c
index 08f4df586c..a98f924b81 100644
--- a/hw/nvram/eeprom93xx.c
+++ b/hw/nvram/eeprom93xx.c
@@ -126,7 +126,7 @@ static const VMStateDescription vmstate_eeprom = {
.version_id = EEPROM_VERSION,
.minimum_version_id = OLD_EEPROM_VERSION,
.minimum_version_id_old = OLD_EEPROM_VERSION,
- .fields = (VMStateField []) {
+ .fields = (VMStateField[]) {
VMSTATE_UINT8(tick, eeprom_t),
VMSTATE_UINT8(address, 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",
eecs, eesk, eedi, eedo, tick);
- if (! eeprom->eecs && eecs) {
+ if (!eeprom->eecs && eecs) {
/* Start chip select cycle. */
logout("Cycle start, waiting for 1st start bit (0)\n");
tick = 0;
command = 0x0;
address = 0x0;
- } else if (eeprom->eecs && ! eecs) {
+ } else if (eeprom->eecs && !eecs) {
/* End chip select cycle. This triggers write / erase. */
if (eeprom->writable) {
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. */
eedo = 1;
- } else if (eecs && ! eeprom->eesk && eesk) {
+ } else if (eecs && !eeprom->eesk && eesk) {
/* Raising edge of clock shifts data in. */
if (tick == 0) {
/* Wait for 1st start bit. */
@@ -230,20 +230,20 @@ void eeprom93xx_write(eeprom_t *eeprom, int eecs, int eesk, int eedi)
if (command == 0) {
/* Command code in upper 2 bits of address. */
switch (address >> (eeprom->addrbits - 2)) {
- case 0:
- logout("write disable command\n");
- eeprom->writable = 0;
- break;
- case 1:
- logout("write all command\n");
- break;
- case 2:
- logout("erase all command\n");
- break;
- case 3:
- logout("write enable command\n");
- eeprom->writable = 1;
- break;
+ case 0:
+ logout("write disable command\n");
+ eeprom->writable = 0;
+ break;
+ case 1:
+ logout("write all command\n");
+ break;
+ case 2:
+ logout("erase all command\n");
+ break;
+ case 3:
+ logout("write enable command\n");
+ eeprom->writable = 1;
+ break;
}
} else {
/* Read, write or erase word. */
@@ -276,7 +276,7 @@ uint16_t eeprom93xx_read(eeprom_t *eeprom)
{
/* Return status of pin DO (0 or 1). */
logout("CS=%u DO=%u\n", eeprom->eecs, eeprom->eedo);
- return (eeprom->eedo);
+ return eeprom->eedo;
}
#if 0
@@ -296,18 +296,18 @@ eeprom_t *eeprom93xx_new(DeviceState *dev, uint16_t nwords)
uint8_t addrbits;
switch (nwords) {
- case 16:
- case 64:
- addrbits = 6;
- break;
- case 128:
- case 256:
- addrbits = 8;
- break;
- default:
- assert(!"Unsupported EEPROM size, fallback to 64 words!");
- nwords = 64;
- addrbits = 6;
+ case 16:
+ case 64:
+ addrbits = 6;
+ break;
+ case 128:
+ case 256:
+ addrbits = 8;
+ break;
+ default:
+ assert(!"Unsupported EEPROM size, fallback to 64 words!");
+ nwords = 64;
+ addrbits = 6;
}
eeprom = (eeprom_t *)g_malloc0(sizeof(*eeprom) + nwords * 2);