Skip to content

Commit 2705bce

Browse files
ehristevandersson
authored andcommitted
soc: qcom: Rework BCM_TCS_CMD macro
Reworked BCM_TCS_CMD macro in order to fix warnings from sparse: drivers/clk/qcom/clk-rpmh.c:270:28: warning: restricted __le32 degrades to integer drivers/clk/qcom/clk-rpmh.c:270:28: warning: restricted __le32 degrades to integer While at it, used u32_encode_bits which made the code easier to follow and removed unnecessary shift definitions. The use of cpu_to_le32 was wrong and thus removed. Signed-off-by: Eugen Hristev <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent 9b01fc6 commit 2705bce

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

include/soc/qcom/tcs.h

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
#ifndef __SOC_QCOM_TCS_H__
77
#define __SOC_QCOM_TCS_H__
88

9+
#include <linux/bitfield.h>
10+
#include <linux/bits.h>
11+
912
#define MAX_RPMH_PAYLOAD 16
1013

1114
/**
@@ -60,22 +63,17 @@ struct tcs_request {
6063
struct tcs_cmd *cmds;
6164
};
6265

63-
#define BCM_TCS_CMD_COMMIT_SHFT 30
64-
#define BCM_TCS_CMD_COMMIT_MASK 0x40000000
65-
#define BCM_TCS_CMD_VALID_SHFT 29
66-
#define BCM_TCS_CMD_VALID_MASK 0x20000000
67-
#define BCM_TCS_CMD_VOTE_X_SHFT 14
68-
#define BCM_TCS_CMD_VOTE_MASK 0x3fff
69-
#define BCM_TCS_CMD_VOTE_Y_SHFT 0
70-
#define BCM_TCS_CMD_VOTE_Y_MASK 0xfffc000
66+
#define BCM_TCS_CMD_COMMIT_MASK BIT(30)
67+
#define BCM_TCS_CMD_VALID_MASK BIT(29)
68+
#define BCM_TCS_CMD_VOTE_MASK GENMASK(13, 0)
69+
#define BCM_TCS_CMD_VOTE_Y_MASK GENMASK(13, 0)
70+
#define BCM_TCS_CMD_VOTE_X_MASK GENMASK(27, 14)
7171

7272
/* Construct a Bus Clock Manager (BCM) specific TCS command */
7373
#define BCM_TCS_CMD(commit, valid, vote_x, vote_y) \
74-
(((commit) << BCM_TCS_CMD_COMMIT_SHFT) | \
75-
((valid) << BCM_TCS_CMD_VALID_SHFT) | \
76-
((cpu_to_le32(vote_x) & \
77-
BCM_TCS_CMD_VOTE_MASK) << BCM_TCS_CMD_VOTE_X_SHFT) | \
78-
((cpu_to_le32(vote_y) & \
79-
BCM_TCS_CMD_VOTE_MASK) << BCM_TCS_CMD_VOTE_Y_SHFT))
74+
(u32_encode_bits(commit, BCM_TCS_CMD_COMMIT_MASK) | \
75+
u32_encode_bits(valid, BCM_TCS_CMD_VALID_MASK) | \
76+
u32_encode_bits(vote_x, BCM_TCS_CMD_VOTE_X_MASK) | \
77+
u32_encode_bits(vote_y, BCM_TCS_CMD_VOTE_Y_MASK))
8078

8179
#endif /* __SOC_QCOM_TCS_H__ */

0 commit comments

Comments
 (0)