Skip to contentSkip to conversation

Fix defines in rf69.h

PATCH Superseded Shahar Avidar 1 participant 6 messages Feb 27, 2024 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Fix defines in rf69.h

This patchset fixes several misuses of the define statement in rf69.h. Duplicted defines.
Define in header instead of source file.
Unused define.
Using units.h macro to define frequency.

v2->v1:
- Fix grammer in commit messages.
- Use units.h macro to define frequency.
- Reorder patches to ensure no conflicts.

Shahar Avidar (5):
staging: pi433: Remove a duplicated FIFO_SIZE define
staging: pi433: Remove a duplicated F_OSC define
staging: pi433: Redefine F_OSC using units.h macro
staging: pi433: Remove the unused FREQUENCY define
staging: pi433: Move FIFO_THRESHOLD define to source file

 drivers/staging/pi433/pi433_if.c | 1 +
 drivers/staging/pi433/rf69.c     | 4 ++--
 drivers/staging/pi433/rf69.h     | 4 ----
 3 files changed, 3 insertions(+), 6 deletions(-)

base-commit: 455c5e12a3b7d08c2ab47b7dd54944901c69cdcd

Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/5 staging: pi433: Remove a duplicated FIFO_SIZE define

FIFO_SIZE is being used in both rf69.c & pi433_if.c source files. It is also already defined in rf69.h header file.

---
 drivers/staging/pi433/rf69.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/pi433/rf69.c +0 -1
index 8c7fab6a46bb..b3b8d1abd3eb 100644
@@ -13,7 +13,6 @@
 #include "rf69_registers.h"
 
 #define F_OSC	  32000000 /* in Hz */
-#define FIFO_SIZE 66	   /* in byte */
 
 /*-------------------------------------------------------------------------*/
 
Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/5 staging: pi433: Remove a duplicated F_OSC define

In reply to Shahar Avidar

F_OSC is already defined & only used by rf69.c source file.

---
 drivers/staging/pi433/rf69.h | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/pi433/rf69.h +0 -1
index 78fa0b8bab8b..52e43a909b03 100644
@@ -12,7 +12,6 @@
 #include "rf69_registers.h"
 
 /* NOTE: Modifying FREQUENCY value impacts CE certification */
-#define F_OSC		32000000	/* Hz */
 #define FREQUENCY	433920000	/* Hz */
 #define FIFO_SIZE	66		/* bytes */
 #define FIFO_THRESHOLD	15		/* bytes */
Signature · 1 line
2.34.1
#3 lore raw

PATCH 3/5 staging: pi433: Redefine F_OSC using units.h macro

In reply to Shahar Avidar

Use HZ_PER_MHZ for a more robust definition.

---
 drivers/staging/pi433/rf69.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/pi433/rf69.c +2 -1
index b3b8d1abd3eb..5a1c362badb6 100644
@@ -8,11 +8,12 @@
 
 #include <linux/types.h>
 #include <linux/spi/spi.h>
+#include <linux/units.h>
 
 #include "rf69.h"
 #include "rf69_registers.h"
 
-#define F_OSC	  32000000 /* in Hz */
+#define F_OSC (32 * HZ_PER_MHZ)
 
 /*-------------------------------------------------------------------------*/
 
Signature · 1 line
2.34.1
#4 lore raw

PATCH 4/5 staging: pi433: Remove the unused FREQUENCY define

In reply to Shahar Avidar

FREQUENCY is not being used, delete its comment.

---
 drivers/staging/pi433/rf69.h | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/pi433/rf69.h +0 -2
index 52e43a909b03..e63e87fd6cce 100644
@@ -11,8 +11,6 @@
 #include "rf69_enum.h"
 #include "rf69_registers.h"
 
-/* NOTE: Modifying FREQUENCY value impacts CE certification */
-#define FREQUENCY	433920000	/* Hz */
 #define FIFO_SIZE	66		/* bytes */
 #define FIFO_THRESHOLD	15		/* bytes */
 
Signature · 1 line
2.34.1
#5 lore raw

PATCH 5/5 staging: pi433: Move FIFO_THRESHOLD define to source file

In reply to Shahar Avidar

FIFO_THRESHOLD is only being used in pi433_if.c source files.

---
 drivers/staging/pi433/pi433_if.c | 1 +
 drivers/staging/pi433/rf69.h     | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)
drivers/staging/pi433/pi433_if.c +1 -0
index 0ec3130225db..b6c4917d515e 100644
@@ -49,6 +49,7 @@
 #define N_PI433_MINORS		BIT(MINORBITS) /*32*/	/* ... up to 256 */
 #define MAX_MSG_SIZE		900	/* min: FIFO_SIZE! */
 #define MSG_FIFO_SIZE		65536   /* 65536 = 2^16  */
+#define FIFO_THRESHOLD	15		/* bytes */
 #define NUM_DIO			2
 
 static dev_t pi433_dev;
drivers/staging/pi433/rf69.h +0 -1
index e63e87fd6cce..76f0f9896a52 100644
@@ -12,7 +12,6 @@
 #include "rf69_registers.h"
 
 #define FIFO_SIZE	66		/* bytes */
-#define FIFO_THRESHOLD	15		/* bytes */
 
 u8 rf69_read_reg(struct spi_device *spi, u8 addr);
 int rf69_get_version(struct spi_device *spi);
Signature · 1 line
2.34.1