Commit 66063033 authored by Jason A. Donenfeld's avatar Jason A. Donenfeld Committed by Kalle Valo
Browse files

wifi: rt2x00: use explicitly signed or unsigned types



On some platforms, `char` is unsigned, but this driver, for the most
part, assumed it was signed. In other places, it uses `char` to mean an
unsigned number, but only in cases when the values are small. And in
still other places, `char` is used as a boolean. Put an end to this
confusion by declaring explicit types, depending on the context.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Stanislaw Gruszka <stf_xl@wp.pl>
Cc: Helmut Schaa <helmut.schaa@googlemail.com>
Cc: Kalle Valo <kvalo@kernel.org>
Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
Acked-by: default avatarStanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20221019155541.3410813-1-Jason@zx2c4.com
parent 6d36c728
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -1023,9 +1023,9 @@ static int rt2400pci_set_state(struct rt2x00_dev *rt2x00dev,
{
	u32 reg, reg2;
	unsigned int i;
	char put_to_sleep;
	char bbp_state;
	char rf_state;
	bool put_to_sleep;
	u8 bbp_state;
	u8 rf_state;

	put_to_sleep = (state != STATE_AWAKE);

@@ -1561,7 +1561,7 @@ static int rt2400pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
{
	struct hw_mode_spec *spec = &rt2x00dev->spec;
	struct channel_info *info;
	char *tx_power;
	u8 *tx_power;
	unsigned int i;

	/*
+1 −1
Original line number Diff line number Diff line
@@ -939,7 +939,7 @@
#define DEFAULT_TXPOWER	39

#define __CLAMP_TX(__txpower) \
	clamp_t(char, (__txpower), MIN_TXPOWER, MAX_TXPOWER)
	clamp_t(u8, (__txpower), MIN_TXPOWER, MAX_TXPOWER)

#define TXPOWER_FROM_DEV(__txpower) \
	((__CLAMP_TX(__txpower) - MAX_TXPOWER) + MIN_TXPOWER)
+4 −4
Original line number Diff line number Diff line
@@ -1176,9 +1176,9 @@ static int rt2500pci_set_state(struct rt2x00_dev *rt2x00dev,
{
	u32 reg, reg2;
	unsigned int i;
	char put_to_sleep;
	char bbp_state;
	char rf_state;
	bool put_to_sleep;
	u8 bbp_state;
	u8 rf_state;

	put_to_sleep = (state != STATE_AWAKE);

@@ -1856,7 +1856,7 @@ static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
{
	struct hw_mode_spec *spec = &rt2x00dev->spec;
	struct channel_info *info;
	char *tx_power;
	u8 *tx_power;
	unsigned int i;

	/*
+1 −1
Original line number Diff line number Diff line
@@ -1219,6 +1219,6 @@
	(((u8)(__txpower)) > MAX_TXPOWER) ? DEFAULT_TXPOWER : (__txpower)

#define TXPOWER_TO_DEV(__txpower) \
	clamp_t(char, __txpower, MIN_TXPOWER, MAX_TXPOWER)
	clamp_t(u8, __txpower, MIN_TXPOWER, MAX_TXPOWER)

#endif /* RT2500PCI_H */
+4 −4
Original line number Diff line number Diff line
@@ -984,9 +984,9 @@ static int rt2500usb_set_state(struct rt2x00_dev *rt2x00dev,
	u16 reg;
	u16 reg2;
	unsigned int i;
	char put_to_sleep;
	char bbp_state;
	char rf_state;
	bool put_to_sleep;
	u8 bbp_state;
	u8 rf_state;

	put_to_sleep = (state != STATE_AWAKE);

@@ -1663,7 +1663,7 @@ static int rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
{
	struct hw_mode_spec *spec = &rt2x00dev->spec;
	struct channel_info *info;
	char *tx_power;
	u8 *tx_power;
	unsigned int i;

	/*
Loading