History

firmware: qcom_scm: Cleanup code in qcom_scm_assign_mem()

There are some questionable coding styles in this function. It looks quite odd to deref a pointer with array indexing that only uses the first element. Also, destroying an input/output variable halfway through the function and then overwriting it on success is not clear. It's better to use a local variable and the kernel macros to step through each bit set in a bitmask and clearly show where outputs are set.

Stephen Boyd committed 7 years ago

Commit af311ff1 parent c8b08fc2 files · +21 −22Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/qcom_scm.h+5−4
@@ -49,8 +49,9 @@ extern int qcom_scm_pas_mem_setup(u32 peripheral, phys_addr_t addr, · 48 unmodified lines
4949 extern int qcom_scm_pas_auth_and_reset(u32 peripheral);
5050 extern int qcom_scm_pas_shutdown(u32 peripheral);
5151 extern int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz,
52− unsigned int *src, struct qcom_scm_vmperm *newvm,
53− int dest_cnt);
52+ unsigned int *src,
53+ const struct qcom_scm_vmperm *newvm,
54+ unsigned int dest_cnt);
5455 extern void qcom_scm_cpu_power_down(u32 flags);
5556 extern u32 qcom_scm_get_version(void);
5657 extern int qcom_scm_set_remote_state(u32 state, u32 id);
@@ -87,8 +88,8 @@ qcom_scm_pas_auth_and_reset(u32 peripheral) { return -ENODEV; } · 30 unmodified lines
8788 static inline int qcom_scm_pas_shutdown(u32 peripheral) { return -ENODEV; }
8889 static inline int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz,
8990 unsigned int *src,
90− struct qcom_scm_vmperm *newvm,
91− int dest_cnt) { return -ENODEV; }
91+ const struct qcom_scm_vmperm *newvm,
92+ unsigned int dest_cnt) { return -ENODEV; }
9293 static inline void qcom_scm_cpu_power_down(u32 flags) {}
9394 static inline u32 qcom_scm_get_version(void) { return 0; }
9495 static inline u32

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t