From: Elia Geretto <elia.f.geretto@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Cc: Elia Geretto <elia.f.geretto@gmail.com>
Subject: [PATCH] staging: pi433: Use matching enum types calling rf69_set_packet_format
Date: Sat, 29 Jul 2017 11:29:13 +0200 [thread overview]
Message-ID: <20170729092913.28821-1-elia.f.geretto@gmail.com> (raw)
This patch fixes the following four warnings found using sparse:
drivers/staging/pi433/pi433_if.c:211:9: warning: mixing different enum types
drivers/staging/pi433/pi433_if.c:211:9: int enum optionOnOff versus
drivers/staging/pi433/pi433_if.c:211:9: int enum packetFormat
drivers/staging/pi433/pi433_if.c:211:9: warning: mixing different enum types
drivers/staging/pi433/pi433_if.c:211:9: int enum optionOnOff versus
drivers/staging/pi433/pi433_if.c:211:9: int enum packetFormat
drivers/staging/pi433/pi433_if.c:268:9: warning: mixing different enum types
drivers/staging/pi433/pi433_if.c:268:9: int enum optionOnOff versus
drivers/staging/pi433/pi433_if.c:268:9: int enum packetFormat
drivers/staging/pi433/pi433_if.c:268:9: warning: mixing different enum types
drivers/staging/pi433/pi433_if.c:268:9: int enum optionOnOff versus
drivers/staging/pi433/pi433_if.c:268:9: int enum packetFormat
This is done calling the rf69_set_packet_format function using the
appropriate enum for the packetFormat argument.
Signed-off-by: Elia Geretto <elia.f.geretto@gmail.com>
---
drivers/staging/pi433/pi433_if.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index d9328ce5ec1d..fc2250810eed 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -208,7 +208,17 @@ 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) {
+ int ret = rf69_set_packet_format(dev->spi, packetLengthVar);
+
+ if (ret < 0)
+ return ret;
+ } else {
+ int ret = rf69_set_packet_format(dev->spi, packetLengthFix);
+
+ if (ret < 0)
+ return ret;
+ }
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 +274,18 @@ 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) {
+ int ret = rf69_set_packet_format(dev->spi, packetLengthVar);
+
+ if (ret < 0)
+ return ret;
+ } else {
+ int ret = rf69_set_packet_format(dev->spi, packetLengthFix);
+
+ if (ret < 0)
+ return ret;
+ }
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 */
--
2.13.3
next reply other threads:[~2017-07-29 9:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-29 9:29 Elia Geretto [this message]
2017-07-30 14:57 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170729092913.28821-1-elia.f.geretto@gmail.com \
--to=elia.f.geretto@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome