[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170728125626.17672-1-elia.f.geretto@gmail.com>
Date: Fri, 28 Jul 2017 14:56:26 +0200
From: Elia Geretto <elia.f.geretto@...il.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Cc: Elia Geretto <elia.f.geretto@...il.com>
Subject: [PATCH] Staging: pi433: fix some warnings detected using sparse
This patch corrects some visibility issues regarding some functions and
solves a warning related to a non-matching union. After this patch,
sparse produces only one other warning regarding a bitwise operator;
however, this behaviour seems to be intended.
Signed-off-by: Elia Geretto <elia.f.geretto@...il.com>
---
drivers/staging/pi433/pi433_if.c | 17 +++++++++++------
drivers/staging/pi433/rf69.c | 4 +++-
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index d9328ce5ec1d..f8219a53ce60 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -208,7 +208,10 @@ rf69_set_rx_cfg(struct pi433_device *dev, struct pi433_rx_cfg *rx_cfg)
{
SET_CHECKED(rf69_set_fifo_fill_condition(dev->spi, always));
}
- SET_CHECKED(rf69_set_packet_format (dev->spi, rx_cfg->enable_length_byte));
+ if (rx_cfg->enable_length_byte == optionOn)
+ SET_CHECKED(rf69_set_packet_format(dev->spi, packetLengthVar));
+ else
+ SET_CHECKED(rf69_set_packet_format(dev->spi, packetLengthFix));
SET_CHECKED(rf69_set_adressFiltering(dev->spi, rx_cfg->enable_address_filtering));
SET_CHECKED(rf69_set_crc_enable (dev->spi, rx_cfg->enable_crc));
@@ -264,8 +267,11 @@ rf69_set_tx_cfg(struct pi433_device *dev, struct pi433_tx_cfg *tx_cfg)
{
SET_CHECKED(rf69_set_preamble_length(dev->spi, 0));
}
+ if (tx_cfg->enable_length_byte == optionOn)
+ SET_CHECKED(rf69_set_packet_format(dev->spi, packetLengthVar));
+ else
+ SET_CHECKED(rf69_set_packet_format(dev->spi, packetLengthFix));
SET_CHECKED(rf69_set_sync_enable (dev->spi, tx_cfg->enable_sync));
- SET_CHECKED(rf69_set_packet_format(dev->spi, tx_cfg->enable_length_byte));
SET_CHECKED(rf69_set_crc_enable (dev->spi, tx_cfg->enable_crc));
/* configure sync, if enabled */
@@ -313,7 +319,7 @@ pi433_start_rx(struct pi433_device *dev)
/*-------------------------------------------------------------------------*/
-int
+static int
pi433_receive(void *data)
{
struct pi433_device *dev = data;
@@ -463,7 +469,7 @@ pi433_receive(void *data)
return bytes_total;
}
-int
+static int
pi433_tx_thread(void *data)
{
struct pi433_device *device = data;
@@ -1152,8 +1158,7 @@ static int pi433_probe(struct spi_device *spi)
device->tx_task_struct = kthread_run(pi433_tx_thread,
device,
"pi433_tx_task");
- if (device->tx_task_struct < 0)
- {
+ if (IS_ERR(device->tx_task_struct)) {
dev_dbg(device->dev, "start of send thread failed");
goto send_thread_failed;
}
diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index e391ce777bc7..52521fa18c9b 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -433,7 +433,9 @@ int rf69_set_dc_cut_off_frequency_during_afc(struct spi_device *spi, enum dccPer
return rf69_set_dc_cut_off_frequency_intern(spi, REG_AFCBW, dccPercent);
}
-int rf69_set_bandwidth_intern(struct spi_device *spi, u8 reg, enum mantisse mantisse, u8 exponent)
+static int
+rf69_set_bandwidth_intern(struct spi_device *spi, u8 reg,
+ enum mantisse mantisse, u8 exponent)
{
u8 newValue;
--
2.13.3
Powered by blists - more mailing lists