Skip to content

Commit be6d43e

Browse files
ruanjinjie-engnmenon
authored andcommitted
firmware: ti_sci: Use list_for_each_entry() helper
Convert list_for_each() to list_for_each_entry() so that the p list_head pointer and list_entry() call are no longer needed, which can reduce a few lines of code. No functional changed. Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Link: https://lore.kernel.org/r/20230830090344.528818-1-ruanjinjie@huawei.com Signed-off-by: Nishanth Menon <nm@ti.com>
1 parent 0bb80ec commit be6d43e

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

drivers/firmware/ti_sci.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2886,7 +2886,6 @@ static void ti_sci_setup_ops(struct ti_sci_info *info)
28862886
const struct ti_sci_handle *ti_sci_get_handle(struct device *dev)
28872887
{
28882888
struct device_node *ti_sci_np;
2889-
struct list_head *p;
28902889
struct ti_sci_handle *handle = NULL;
28912890
struct ti_sci_info *info;
28922891

@@ -2901,8 +2900,7 @@ const struct ti_sci_handle *ti_sci_get_handle(struct device *dev)
29012900
}
29022901

29032902
mutex_lock(&ti_sci_list_mutex);
2904-
list_for_each(p, &ti_sci_list) {
2905-
info = list_entry(p, struct ti_sci_info, node);
2903+
list_for_each_entry(info, &ti_sci_list, node) {
29062904
if (ti_sci_np == info->dev->of_node) {
29072905
handle = &info->handle;
29082906
info->users++;
@@ -3012,7 +3010,6 @@ const struct ti_sci_handle *ti_sci_get_by_phandle(struct device_node *np,
30123010
struct ti_sci_handle *handle = NULL;
30133011
struct device_node *ti_sci_np;
30143012
struct ti_sci_info *info;
3015-
struct list_head *p;
30163013

30173014
if (!np) {
30183015
pr_err("I need a device pointer\n");
@@ -3024,8 +3021,7 @@ const struct ti_sci_handle *ti_sci_get_by_phandle(struct device_node *np,
30243021
return ERR_PTR(-ENODEV);
30253022

30263023
mutex_lock(&ti_sci_list_mutex);
3027-
list_for_each(p, &ti_sci_list) {
3028-
info = list_entry(p, struct ti_sci_info, node);
3024+
list_for_each_entry(info, &ti_sci_list, node) {
30293025
if (ti_sci_np == info->dev->of_node) {
30303026
handle = &info->handle;
30313027
info->users++;

0 commit comments

Comments
 (0)