linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6 v5] staging: pi433: collapse else block after return statement
@ 2017-12-19 14:56 Valentin Vidic
  2017-12-19 14:56 ` [PATCH 2/6 v5] staging: pi433: cleanup local variable declaration Valentin Vidic
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Valentin Vidic @ 2017-12-19 14:56 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Dan Carpenter, devel, linux-kernel, Marcin Ciupak, Marcus Wolf,
	Simon Sandström, Marcus Wolf, Valentin Vidic

Fixes checkpatch warning:

  WARNING: else is not generally useful after a break or return

Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr>
---
v5: resend patchset based on comments

 drivers/staging/pi433/pi433_if.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index b4e6094ad553..02887988d2ea 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -773,11 +773,11 @@ pi433_read(struct file *filp, char __user *buf, size_t size, loff_t *f_pos)
 	if (device->rx_active) {
 		mutex_unlock(&device->rx_lock);
 		return -EAGAIN;
-	} else {
-		device->rx_active = true;
-		mutex_unlock(&device->rx_lock);
 	}
 
+	device->rx_active = true;
+	mutex_unlock(&device->rx_lock);
+
 	/* start receiving */
 	/* will block until something was received*/
 	device->rx_buffer_size = size;
@@ -1117,12 +1117,12 @@ static int pi433_probe(struct spi_device *spi)
 	if (retval) {
 		dev_dbg(&spi->dev, "configuration of SPI interface failed!\n");
 		return retval;
-	} else {
-		dev_dbg(&spi->dev,
-			"spi interface setup: mode 0x%2x, %d bits per word, %dhz max speed",
-			spi->mode, spi->bits_per_word, spi->max_speed_hz);
 	}
 
+	dev_dbg(&spi->dev,
+		"spi interface setup: mode 0x%2x, %d bits per word, %dhz max speed",
+		spi->mode, spi->bits_per_word, spi->max_speed_hz);
+
 	/* Ping the chip by reading the version register */
 	retval = spi_w8r8(spi, 0x10);
 	if (retval < 0)
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/6 v5] staging: pi433: cleanup local variable declaration
  2017-12-19 14:56 [PATCH 1/6 v5] staging: pi433: collapse else block after return statement Valentin Vidic
@ 2017-12-19 14:56 ` Valentin Vidic
  2017-12-19 14:56 ` [PATCH 3/6 v5] staging: pi433: replace unsigned with unsigned int Valentin Vidic
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Valentin Vidic @ 2017-12-19 14:56 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Dan Carpenter, devel, linux-kernel, Marcin Ciupak, Marcus Wolf,
	Simon Sandström, Marcus Wolf, Valentin Vidic

Fix variable naming and checkpatch warning:

  WARNING: Missing a blank line after declarations

Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr>
---
v5: resend patchset based on comments

 drivers/staging/pi433/pi433_if.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 02887988d2ea..86709a7100ad 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -699,13 +699,15 @@ pi433_tx_thread(void *data)
 		repetitions = tx_cfg.repetitions;
 		while ((repetitions > 0) && (size > position)) {
 			if ((size - position) > device->free_in_fifo) {
+				int write_size;
+
 				/* msg to big for fifo - take a part */
-				int temp = device->free_in_fifo;
+				write_size = device->free_in_fifo;
 				device->free_in_fifo = 0;
 				rf69_write_fifo(spi,
 						&buffer[position],
-						temp);
-				position += temp;
+						write_size);
+				position += write_size;
 			} else {
 				/* msg fits into fifo - take all */
 				device->free_in_fifo -= size;
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/6 v5] staging: pi433: replace unsigned with unsigned int
  2017-12-19 14:56 [PATCH 1/6 v5] staging: pi433: collapse else block after return statement Valentin Vidic
  2017-12-19 14:56 ` [PATCH 2/6 v5] staging: pi433: cleanup local variable declaration Valentin Vidic
@ 2017-12-19 14:56 ` Valentin Vidic
  2017-12-19 14:56 ` [PATCH 4/6 v5] staging: pi433: avoid logging ENOMEM messages Valentin Vidic
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Valentin Vidic @ 2017-12-19 14:56 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Dan Carpenter, devel, linux-kernel, Marcin Ciupak, Marcus Wolf,
	Simon Sandström, Marcus Wolf, Valentin Vidic

Fixes checkpatch warning:

  WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr>
---
v5: resend patchset based on comments

 drivers/staging/pi433/pi433_if.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 86709a7100ad..6e147cd351c7 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -78,7 +78,7 @@ struct pi433_device {
 	struct device		*dev;
 	struct cdev		*cdev;
 	struct spi_device	*spi;
-	unsigned		users;
+	unsigned int		users;
 
 	/* irq related values */
 	struct gpio_desc	*gpiod[NUM_DIO];
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/6 v5] staging: pi433: avoid logging ENOMEM messages
  2017-12-19 14:56 [PATCH 1/6 v5] staging: pi433: collapse else block after return statement Valentin Vidic
  2017-12-19 14:56 ` [PATCH 2/6 v5] staging: pi433: cleanup local variable declaration Valentin Vidic
  2017-12-19 14:56 ` [PATCH 3/6 v5] staging: pi433: replace unsigned with unsigned int Valentin Vidic
@ 2017-12-19 14:56 ` Valentin Vidic
  2017-12-19 14:56 ` [PATCH 5/6 v5] staging: pi433: replace printk calls with dev_dbg Valentin Vidic
  2017-12-19 14:56 ` [PATCH 6/6 v5] staging: pi433: remove unused function Valentin Vidic
  4 siblings, 0 replies; 6+ messages in thread
From: Valentin Vidic @ 2017-12-19 14:56 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Dan Carpenter, devel, linux-kernel, Marcin Ciupak, Marcus Wolf,
	Simon Sandström, Marcus Wolf, Valentin Vidic

Fixes checkpatch warning:

  WARNING: Possible unnecessary 'out of memory' message

Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr>
---
v5: resend patchset based on comments

 drivers/staging/pi433/pi433_if.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 6e147cd351c7..287bfa4e270f 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -937,10 +937,8 @@ static int pi433_open(struct inode *inode, struct file *filp)
 
 	if (!device->rx_buffer) {
 		device->rx_buffer = kmalloc(MAX_MSG_SIZE, GFP_KERNEL);
-		if (!device->rx_buffer) {
-			dev_dbg(device->dev, "open/ENOMEM\n");
+		if (!device->rx_buffer)
 			return -ENOMEM;
-		}
 	}
 
 	device->users++;
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 5/6 v5] staging: pi433: replace printk calls with dev_dbg
  2017-12-19 14:56 [PATCH 1/6 v5] staging: pi433: collapse else block after return statement Valentin Vidic
                   ` (2 preceding siblings ...)
  2017-12-19 14:56 ` [PATCH 4/6 v5] staging: pi433: avoid logging ENOMEM messages Valentin Vidic
@ 2017-12-19 14:56 ` Valentin Vidic
  2017-12-19 14:56 ` [PATCH 6/6 v5] staging: pi433: remove unused function Valentin Vidic
  4 siblings, 0 replies; 6+ messages in thread
From: Valentin Vidic @ 2017-12-19 14:56 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Dan Carpenter, devel, linux-kernel, Marcin Ciupak, Marcus Wolf,
	Simon Sandström, Marcus Wolf, Valentin Vidic

Fixes checkpatch warning:

  WARNING: printk() should include KERN_<LEVEL> facility level

Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr>
---
v5: resend patchset based on comments

 drivers/staging/pi433/pi433_if.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 287bfa4e270f..1aa83cb3f15a 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -721,7 +721,7 @@ pi433_tx_thread(void *data)
 			retval = wait_event_interruptible(device->fifo_wait_queue,
 							  device->free_in_fifo > 0);
 			if (retval) {
-				printk("ABORT\n");
+				dev_dbg(device->dev, "ABORT\n");
 				goto abort;
 			}
 		}
@@ -732,7 +732,7 @@ pi433_tx_thread(void *data)
 					 device->free_in_fifo == FIFO_SIZE ||
 					 kthread_should_stop());
 		if (kthread_should_stop())
-			printk("ABORT\n");
+			dev_dbg(device->dev, "ABORT\n");
 
 		/* STOP_TRANSMISSION */
 		dev_dbg(device->dev, "thread: Packet sent. Set mode to stby.");
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 6/6 v5] staging: pi433: remove unused function
  2017-12-19 14:56 [PATCH 1/6 v5] staging: pi433: collapse else block after return statement Valentin Vidic
                   ` (3 preceding siblings ...)
  2017-12-19 14:56 ` [PATCH 5/6 v5] staging: pi433: replace printk calls with dev_dbg Valentin Vidic
@ 2017-12-19 14:56 ` Valentin Vidic
  4 siblings, 0 replies; 6+ messages in thread
From: Valentin Vidic @ 2017-12-19 14:56 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Dan Carpenter, devel, linux-kernel, Marcin Ciupak, Marcus Wolf,
	Simon Sandström, Marcus Wolf, Valentin Vidic

As it turns out rf69_get_lna_gain is not used at all.

Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr>
---
v5: resend patchset based on comments

 drivers/staging/pi433/rf69.c | 18 ------------------
 drivers/staging/pi433/rf69.h |  1 -
 2 files changed, 19 deletions(-)

diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index d777e31688ad..f58b925bb1da 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -334,24 +334,6 @@ int rf69_set_lna_gain(struct spi_device *spi, enum lnaGain lnaGain)
 	}
 }
 
-enum lnaGain rf69_get_lna_gain(struct spi_device *spi)
-{
-	u8 currentValue;
-
-	currentValue = rf69_read_reg(spi, REG_LNA);
-
-	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;
-	case LNA_GAIN_MAX_MINUS_12: return maxMinus12;
-	case LNA_GAIN_MAX_MINUS_24: return maxMinus24;
-	case LNA_GAIN_MAX_MINUS_36: return maxMinus36;
-	case LNA_GAIN_MAX_MINUS_48: return maxMinus48;
-	default:		    return undefined;
-	}
-}
-
 int rf69_set_dc_cut_off_frequency_intern(struct spi_device *spi, u8 reg, enum dcc_percent dcc_percent)
 {
 	switch (dcc_percent) {
diff --git a/drivers/staging/pi433/rf69.h b/drivers/staging/pi433/rf69.h
index 079acbd8a366..e90228a0ca29 100644
--- a/drivers/staging/pi433/rf69.h
+++ b/drivers/staging/pi433/rf69.h
@@ -39,7 +39,6 @@ int rf69_set_output_power_level(struct spi_device *spi, u8 powerLevel);
 int rf69_set_pa_ramp(struct spi_device *spi, enum paRamp paRamp);
 int rf69_set_antenna_impedance(struct spi_device *spi, enum antennaImpedance antennaImpedance);
 int rf69_set_lna_gain(struct spi_device *spi, enum lnaGain lnaGain);
-enum lnaGain rf69_get_lna_gain(struct spi_device *spi);
 int rf69_set_dc_cut_off_frequency_intern(struct spi_device *spi, u8 reg, enum dcc_percent dcc_percent);
 int rf69_set_dc_cut_off_frequency(struct spi_device *spi, enum dcc_percent dcc_percent);
 int rf69_set_dc_cut_off_frequency_during_afc(struct spi_device *spi, enum dcc_percent dcc_percent);
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-12-19 14:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-19 14:56 [PATCH 1/6 v5] staging: pi433: collapse else block after return statement Valentin Vidic
2017-12-19 14:56 ` [PATCH 2/6 v5] staging: pi433: cleanup local variable declaration Valentin Vidic
2017-12-19 14:56 ` [PATCH 3/6 v5] staging: pi433: replace unsigned with unsigned int Valentin Vidic
2017-12-19 14:56 ` [PATCH 4/6 v5] staging: pi433: avoid logging ENOMEM messages Valentin Vidic
2017-12-19 14:56 ` [PATCH 5/6 v5] staging: pi433: replace printk calls with dev_dbg Valentin Vidic
2017-12-19 14:56 ` [PATCH 6/6 v5] staging: pi433: remove unused function Valentin Vidic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).