drm/amd: use list_for_each_entry for list iteration.
authorWambui Karuga <wambui.karugax@gmail.com>
Fri, 3 Jan 2020 19:18:52 +0000 (22:18 +0300)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 7 Jan 2020 17:04:16 +0000 (12:04 -0500)
list_for_each() can be replaced by the more concise
list_for_each_entry() here for iteration over the lists.
This change was reported by coccinelle.

Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c

index 64445c4cc4c2e1d3b708553428dad3c2c2f6932a..cbcf504f73a51a5e5195ab09d359a91e1846efa3 100644 (file)
@@ -111,17 +111,12 @@ static void init_handler_common_data(struct amdgpu_dm_irq_handler_data *hcd,
  */
 static void dm_irq_work_func(struct work_struct *work)
 {
-       struct list_head *entry;
        struct irq_list_head *irq_list_head =
                container_of(work, struct irq_list_head, work);
        struct list_head *handler_list = &irq_list_head->head;
        struct amdgpu_dm_irq_handler_data *handler_data;
 
-       list_for_each(entry, handler_list) {
-               handler_data = list_entry(entry,
-                                         struct amdgpu_dm_irq_handler_data,
-                                         list);
-
+       list_for_each_entry(handler_data, handler_list, list) {
                DRM_DEBUG_KMS("DM_IRQ: work_func: for dal_src=%d\n",
                                handler_data->irq_source);
 
@@ -528,19 +523,13 @@ static void amdgpu_dm_irq_immediate_work(struct amdgpu_device *adev,
                                         enum dc_irq_source irq_source)
 {
        struct amdgpu_dm_irq_handler_data *handler_data;
-       struct list_head *entry;
        unsigned long irq_table_flags;
 
        DM_IRQ_TABLE_LOCK(adev, irq_table_flags);
 
-       list_for_each(
-               entry,
-               &adev->dm.irq_handler_list_high_tab[irq_source]) {
-
-               handler_data = list_entry(entry,
-                                         struct amdgpu_dm_irq_handler_data,
-                                         list);
-
+       list_for_each_entry(handler_data,
+                           &adev->dm.irq_handler_list_high_tab[irq_source],
+                           list) {
                /* Call a subcomponent which registered for immediate
                 * interrupt notification */
                handler_data->handler(handler_data->handler_arg);