2017-08-10 13:40:57

by Marcin Ciupak

[permalink] [raw]
Subject: [PATCH 0/3] staging: pi433: rf69.c style errors fixes - braces

This set of patches is intended to fix coding style errors with braces in
rf69.c file in order to comply with kernel coding style guide as requested
by TODO file.

The following errors were fixed:
ERROR: that open brace { should be on the previous line
ERROR: else should follow close brace '}'
ERROR: space required before the open brace '{'

Marcin Ciupak (3):
staging: pi433: rf69.c style fix - that open brace
staging: pi433: rf69.c style fix - else close brace
staging: pi433: rf69.c style fix - spaces open brace

drivers/staging/pi433/rf69.c | 36 ++++++++++++------------------------
1 file changed, 12 insertions(+), 24 deletions(-)

--
2.13.0


2017-08-10 13:41:16

by Marcin Ciupak

[permalink] [raw]
Subject: [PATCH 1/3] staging: pi433: rf69.c style fix - that open brace

This patch fixes the following checkpatch.pl error:

ERROR: that open brace { should be on the previous line

in rf69.c file as requested by TODO file.

Note:
ERROR: else should follow close brace '}'
remains valid here and is going to be fixed by the next patch in set.

Additionally some style warnings remain valid here and could be fixed by
another patch.

Signed-off-by: Marcin Ciupak <[email protected]>
---
drivers/staging/pi433/rf69.c | 33 +++++++++++----------------------
1 file changed, 11 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index f83523e3395d..3afd217b79a7 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -101,8 +101,7 @@ enum modulation rf69_get_modulation(struct spi_device *spi)

currentValue = READ_REG(REG_DATAMODUL);

- switch (currentValue & MASK_DATAMODUL_MODULATION_TYPE >> 3) // TODO improvement: change 3 to define
- {
+ switch (currentValue & MASK_DATAMODUL_MODULATION_TYPE >> 3) { // TODO improvement: change 3 to define
case DATAMODUL_MODULATION_TYPE_OOK: return OOK;
case DATAMODUL_MODULATION_TYPE_FSK: return FSK;
default: return undefined;
@@ -115,8 +114,7 @@ int rf69_set_modulation_shaping(struct spi_device *spi, enum modShaping modShapi
dev_dbg(&spi->dev, "set: mod shaping");
#endif

- if (rf69_get_modulation(spi) == FSK)
- {
+ if (rf69_get_modulation(spi) == FSK) {
switch (modShaping) {
case shapingOff: return WRITE_REG(REG_DATAMODUL, (READ_REG(REG_DATAMODUL) & ~MASK_DATAMODUL_MODULATION_SHAPE) | DATAMODUL_MODULATION_SHAPE_NONE);
case shaping1_0: return WRITE_REG(REG_DATAMODUL, (READ_REG(REG_DATAMODUL) & ~MASK_DATAMODUL_MODULATION_SHAPE) | DATAMODUL_MODULATION_SHAPE_1_0);
@@ -125,8 +123,7 @@ int rf69_set_modulation_shaping(struct spi_device *spi, enum modShaping modShapi
default: INVALID_PARAM;
}
}
- else
- {
+ else {
switch (modShaping) {
case shapingOff: return WRITE_REG(REG_DATAMODUL, (READ_REG(REG_DATAMODUL) & ~MASK_DATAMODUL_MODULATION_SHAPE) | DATAMODUL_MODULATION_SHAPE_NONE);
case shapingBR: return WRITE_REG(REG_DATAMODUL, (READ_REG(REG_DATAMODUL) & ~MASK_DATAMODUL_MODULATION_SHAPE) | DATAMODUL_MODULATION_SHAPE_BR);
@@ -150,8 +147,7 @@ int rf69_set_bit_rate(struct spi_device *spi, u16 bitRate)

// check input value
bitRate_min = F_OSC / 8388608; // 8388608 = 2^23;
- if (bitRate < bitRate_min)
- {
+ if (bitRate < bitRate_min) {
dev_dbg(&spi->dev, "setBitRate: illegal input param");
INVALID_PARAM;
}
@@ -185,8 +181,7 @@ int rf69_set_deviation(struct spi_device *spi, u32 deviation)
dev_dbg(&spi->dev, "set: deviation");
#endif

- if (deviation < 600 || deviation > 500000) //TODO: Abh?ngigkeit von Bitrate beachten!!
- {
+ if (deviation < 600 || deviation > 500000) { //TODO: Abh?ngigkeit von Bitrate beachten!!
dev_dbg(&spi->dev, "set_deviation: illegal input param");
INVALID_PARAM;
}
@@ -203,8 +198,7 @@ int rf69_set_deviation(struct spi_device *spi, u32 deviation)
lsb = (f_reg&0xff);

// check msb
- if (msb & !FDEVMASB_MASK)
- {
+ if (msb & !FDEVMASB_MASK) {
dev_dbg(&spi->dev, "set_deviation: err in calc of msb");
INVALID_PARAM;
}
@@ -239,8 +233,7 @@ int rf69_set_frequency(struct spi_device *spi, u32 frequency)

// check input value
f_max = div_u64(f_step * 8388608, factor);
- if (frequency > f_max)
- {
+ if (frequency > f_max) {
dev_dbg(&spi->dev, "setFrequency: illegal input param");
INVALID_PARAM;
}
@@ -387,8 +380,7 @@ enum lnaGain rf69_get_lna_gain(struct spi_device *spi)

currentValue = READ_REG(REG_LNA);

- switch (currentValue & MASK_LNA_CURRENT_GAIN >> 3) // improvement: change 3 to define
- {
+ switch (currentValue & MASK_LNA_CURRENT_GAIN >> 3) { // improvement: change 3 to define
case LNA_GAIN_AUTO: return automatic;
case LNA_GAIN_MAX: return max;
case LNA_GAIN_MAX_MINUS_6: return maxMinus6;
@@ -488,8 +480,7 @@ int rf69_set_ook_threshold_type(struct spi_device *spi, enum thresholdType thres
dev_dbg(&spi->dev, "set: threshold type");
#endif

- switch (thresholdType)
- {
+ switch (thresholdType) {
case fixed: return WRITE_REG(REG_OOKPEAK, ( (READ_REG(REG_OOKPEAK) & ~MASK_OOKPEAK_THRESTYPE) | OOKPEAK_THRESHTYPE_FIXED) );
case peak: return WRITE_REG(REG_OOKPEAK, ( (READ_REG(REG_OOKPEAK) & ~MASK_OOKPEAK_THRESTYPE) | OOKPEAK_THRESHTYPE_PEAK) );
case average: return WRITE_REG(REG_OOKPEAK, ( (READ_REG(REG_OOKPEAK) & ~MASK_OOKPEAK_THRESTYPE) | OOKPEAK_THRESHTYPE_AVERAGE) );
@@ -875,8 +866,7 @@ int rf69_read_fifo (struct spi_device *spi, u8 *buffer, unsigned int size)
u8 local_buffer[FIFO_SIZE + 1];
int retval;

- if (size > FIFO_SIZE)
- {
+ if (size > FIFO_SIZE) {
#ifdef DEBUG
dev_dbg(&spi->dev, "read fifo: passed in buffer bigger then internal buffer \n");
#endif
@@ -910,8 +900,7 @@ int rf69_write_fifo(struct spi_device *spi, u8 *buffer, unsigned int size)
char spi_address = REG_FIFO | WRITE_BIT;
u8 local_buffer[FIFO_SIZE + 1];

- if (size > FIFO_SIZE)
- {
+ if (size > FIFO_SIZE) {
#ifdef DEBUG
dev_dbg(&spi->dev, "read fifo: passed in buffer bigger then internal buffer \n");
#endif
--
2.13.0

2017-08-10 13:41:34

by Marcin Ciupak

[permalink] [raw]
Subject: [PATCH 2/3] staging: pi433: rf69.c style fix - else close brace

This patch fixes the following checkpatch.pl error:

ERROR: else should follow close brace '}'

in rf69.c file as requested by TODO file.

Signed-off-by: Marcin Ciupak <[email protected]>
---
drivers/staging/pi433/rf69.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index 3afd217b79a7..746ef70babf7 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -122,8 +122,7 @@ int rf69_set_modulation_shaping(struct spi_device *spi, enum modShaping modShapi
case shaping0_3: return WRITE_REG(REG_DATAMODUL, (READ_REG(REG_DATAMODUL) & ~MASK_DATAMODUL_MODULATION_SHAPE) | DATAMODUL_MODULATION_SHAPE_0_5);
default: INVALID_PARAM;
}
- }
- else {
+ } else {
switch (modShaping) {
case shapingOff: return WRITE_REG(REG_DATAMODUL, (READ_REG(REG_DATAMODUL) & ~MASK_DATAMODUL_MODULATION_SHAPE) | DATAMODUL_MODULATION_SHAPE_NONE);
case shapingBR: return WRITE_REG(REG_DATAMODUL, (READ_REG(REG_DATAMODUL) & ~MASK_DATAMODUL_MODULATION_SHAPE) | DATAMODUL_MODULATION_SHAPE_BR);
--
2.13.0

2017-08-10 13:41:57

by Marcin Ciupak

[permalink] [raw]
Subject: [PATCH 3/3] staging: pi433: rf69.c style fix - spaces open brace

This patch fixes the following checkpatch.pl error:

ERROR: space required before the open brace '{'

in rf69.c file as requested by TODO file.

Signed-off-by: Marcin Ciupak <[email protected]>
---
drivers/staging/pi433/rf69.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index 746ef70babf7..3e37bd205229 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -49,7 +49,7 @@ int rf69_set_mode(struct spi_device *spi, enum mode mode)
dev_dbg(&spi->dev, "set: mode");
#endif

- switch (mode){
+ switch (mode) {
case transmit: return WRITE_REG(REG_OPMODE, (READ_REG(REG_OPMODE) & ~MASK_OPMODE_MODE) | OPMODE_MODE_TRANSMIT);
case receive: return WRITE_REG(REG_OPMODE, (READ_REG(REG_OPMODE) & ~MASK_OPMODE_MODE) | OPMODE_MODE_RECEIVE);
case synthesizer: return WRITE_REG(REG_OPMODE, (READ_REG(REG_OPMODE) & ~MASK_OPMODE_MODE) | OPMODE_MODE_SYNTHESIZER);
--
2.13.0