Skip to content

Commit

Permalink
media: dvb_frontend.h: Fix shifting signed 32-bit value problem
Browse files Browse the repository at this point in the history
Fix DVBFE_ALGO_RECOVERY and DVBFE_ALGO_SEARCH_ERROR use BIT macro which
fixes undefined behavior error by certain compilers.

Also changed all other bit shifted definitions to use macro for better
readability.

Signed-off-by: Luke Nowakowski-Krijger <[email protected]>
Signed-off-by: Sean Young <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
Luke Nowakowski-Krijger authored and mchehab committed Aug 14, 2019
1 parent f6af820 commit 5532c62
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions include/media/dvb_frontend.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <linux/delay.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/bitops.h>

#include <linux/dvb/frontend.h>

Expand Down Expand Up @@ -141,10 +142,10 @@ struct analog_parameters {
* These devices have AUTO recovery capabilities from LOCK failure
*/
enum dvbfe_algo {
DVBFE_ALGO_HW = (1 << 0),
DVBFE_ALGO_SW = (1 << 1),
DVBFE_ALGO_CUSTOM = (1 << 2),
DVBFE_ALGO_RECOVERY = (1 << 31)
DVBFE_ALGO_HW = BIT(0),
DVBFE_ALGO_SW = BIT(1),
DVBFE_ALGO_CUSTOM = BIT(2),
DVBFE_ALGO_RECOVERY = BIT(31),
};

/**
Expand All @@ -170,12 +171,12 @@ enum dvbfe_algo {
* The frontend search algorithm was requested to search again
*/
enum dvbfe_search {
DVBFE_ALGO_SEARCH_SUCCESS = (1 << 0),
DVBFE_ALGO_SEARCH_ASLEEP = (1 << 1),
DVBFE_ALGO_SEARCH_FAILED = (1 << 2),
DVBFE_ALGO_SEARCH_INVALID = (1 << 3),
DVBFE_ALGO_SEARCH_AGAIN = (1 << 4),
DVBFE_ALGO_SEARCH_ERROR = (1 << 31),
DVBFE_ALGO_SEARCH_SUCCESS = BIT(0),
DVBFE_ALGO_SEARCH_ASLEEP = BIT(1),
DVBFE_ALGO_SEARCH_FAILED = BIT(2),
DVBFE_ALGO_SEARCH_INVALID = BIT(3),
DVBFE_ALGO_SEARCH_AGAIN = BIT(4),
DVBFE_ALGO_SEARCH_ERROR = BIT(31),
};

/**
Expand Down

0 comments on commit 5532c62

Please sign in to comment.