Skip to content

Commit 8231ac7

Browse files
committed
drm/i915: use NULL for zero wakeref_t instead of plain integer 0
As of commit 2edc6a7 ("drm/i915: switch intel_wakeref_t underlying type to struct ref_tracker *") we gained quite a few sparse warnings about "Using plain integer as NULL pointer" for using 0 to initialize wakeref_t. Switch to NULL everywhere. Signed-off-by: Jani Nikula <[email protected]> Reviewed-by: Chaitanya Kumar Borah <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 45c5486 commit 8231ac7

15 files changed

+32
-32
lines changed

drivers/gpu/drm/i915/display/intel_display.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7694,7 +7694,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
76947694
struct intel_crtc_state *new_crtc_state, *old_crtc_state;
76957695
struct intel_crtc *crtc;
76967696
struct intel_power_domain_mask put_domains[I915_MAX_PIPES] = {};
7697-
intel_wakeref_t wakeref = 0;
7697+
intel_wakeref_t wakeref = NULL;
76987698
int i;
76997699

77007700
for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i)

drivers/gpu/drm/i915/display/intel_display_power.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ intel_display_power_get_if_enabled(struct drm_i915_private *dev_priv,
545545

546546
wakeref = intel_runtime_pm_get_if_in_use(&dev_priv->runtime_pm);
547547
if (!wakeref)
548-
return 0;
548+
return NULL;
549549

550550
mutex_lock(&power_domains->lock);
551551

@@ -560,7 +560,7 @@ intel_display_power_get_if_enabled(struct drm_i915_private *dev_priv,
560560

561561
if (!is_enabled) {
562562
intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref);
563-
wakeref = 0;
563+
wakeref = NULL;
564564
}
565565

566566
return wakeref;
@@ -648,7 +648,7 @@ intel_display_power_put_async_work(struct work_struct *work)
648648
struct i915_power_domains *power_domains = &dev_priv->display.power.domains;
649649
struct intel_runtime_pm *rpm = &dev_priv->runtime_pm;
650650
intel_wakeref_t new_work_wakeref = intel_runtime_pm_get_raw(rpm);
651-
intel_wakeref_t old_work_wakeref = 0;
651+
intel_wakeref_t old_work_wakeref = NULL;
652652

653653
mutex_lock(&power_domains->lock);
654654

drivers/gpu/drm/i915/display/intel_display_power.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,10 @@ void gen9_dbuf_slices_update(struct drm_i915_private *dev_priv,
297297

298298
#define with_intel_display_power(i915, domain, wf) \
299299
for ((wf) = intel_display_power_get((i915), (domain)); (wf); \
300-
intel_display_power_put_async((i915), (domain), (wf)), (wf) = 0)
300+
intel_display_power_put_async((i915), (domain), (wf)), (wf) = NULL)
301301

302302
#define with_intel_display_power_if_enabled(i915, domain, wf) \
303303
for ((wf) = intel_display_power_get_if_enabled((i915), (domain)); (wf); \
304-
intel_display_power_put_async((i915), (domain), (wf)), (wf) = 0)
304+
intel_display_power_put_async((i915), (domain), (wf)), (wf) = NULL)
305305

306306
#endif /* __INTEL_DISPLAY_POWER_H__ */

drivers/gpu/drm/i915/display/intel_pps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ intel_wakeref_t intel_pps_unlock(struct intel_dp *intel_dp,
8787
mutex_unlock(&display->pps.mutex);
8888
intel_display_power_put(dev_priv, POWER_DOMAIN_DISPLAY_CORE, wakeref);
8989

90-
return 0;
90+
return NULL;
9191
}
9292

9393
static void

drivers/gpu/drm/i915/gem/i915_gem_shrinker.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ i915_gem_shrink(struct i915_gem_ww_ctx *ww,
117117
},
118118
{ NULL, 0 },
119119
}, *phase;
120-
intel_wakeref_t wakeref = 0;
120+
intel_wakeref_t wakeref = NULL;
121121
unsigned long count = 0;
122122
unsigned long scanned = 0;
123123
int err = 0, i = 0;

drivers/gpu/drm/i915/gem/i915_gem_ttm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ static vm_fault_t vm_fault_ttm(struct vm_fault *vmf)
10381038
struct ttm_buffer_object *bo = area->vm_private_data;
10391039
struct drm_device *dev = bo->base.dev;
10401040
struct drm_i915_gem_object *obj = i915_ttm_to_gem(bo);
1041-
intel_wakeref_t wakeref = 0;
1041+
intel_wakeref_t wakeref = NULL;
10421042
vm_fault_t ret;
10431043
int idx;
10441044

@@ -1195,7 +1195,7 @@ static u64 i915_ttm_mmap_offset(struct drm_i915_gem_object *obj)
11951195
static void i915_ttm_unmap_virtual(struct drm_i915_gem_object *obj)
11961196
{
11971197
struct ttm_buffer_object *bo = i915_gem_to_ttm(obj);
1198-
intel_wakeref_t wakeref = 0;
1198+
intel_wakeref_t wakeref = NULL;
11991199

12001200
assert_object_held_shared(obj);
12011201

drivers/gpu/drm/i915/gt/intel_breadcrumbs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static void __intel_breadcrumbs_disarm_irq(struct intel_breadcrumbs *b)
7070
if (!--b->irq_enabled)
7171
b->irq_disable(b);
7272

73-
WRITE_ONCE(b->irq_armed, 0);
73+
WRITE_ONCE(b->irq_armed, NULL);
7474
intel_gt_pm_put_async(b->irq_engine->gt, wakeref);
7575
}
7676

drivers/gpu/drm/i915/gt/intel_gt_pm.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static inline void __intel_gt_pm_get(struct intel_gt *gt)
3535
static inline intel_wakeref_t intel_gt_pm_get_if_awake(struct intel_gt *gt)
3636
{
3737
if (!intel_wakeref_get_if_active(&gt->wakeref))
38-
return 0;
38+
return NULL;
3939

4040
return intel_wakeref_track(&gt->wakeref);
4141
}
@@ -73,7 +73,7 @@ static inline void intel_gt_pm_put_async(struct intel_gt *gt, intel_wakeref_t ha
7373
}
7474

7575
#define with_intel_gt_pm(gt, wf) \
76-
for (wf = intel_gt_pm_get(gt); wf; intel_gt_pm_put(gt, wf), wf = 0)
76+
for ((wf) = intel_gt_pm_get(gt); (wf); intel_gt_pm_put((gt), (wf)), (wf) = NULL)
7777

7878
/**
7979
* with_intel_gt_pm_if_awake - if GT is PM awake, get a reference to prevent
@@ -84,7 +84,7 @@ static inline void intel_gt_pm_put_async(struct intel_gt *gt, intel_wakeref_t ha
8484
* @wf: pointer to a temporary wakeref.
8585
*/
8686
#define with_intel_gt_pm_if_awake(gt, wf) \
87-
for (wf = intel_gt_pm_get_if_awake(gt); wf; intel_gt_pm_put_async(gt, wf), wf = 0)
87+
for ((wf) = intel_gt_pm_get_if_awake(gt); (wf); intel_gt_pm_put_async((gt), (wf)), (wf) = NULL)
8888

8989
static inline int intel_gt_pm_wait_for_idle(struct intel_gt *gt)
9090
{

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ static ktime_t guc_engine_busyness(struct intel_engine_cs *engine, ktime_t *now)
13391339
* start_gt_clk is derived from GuC state. To get a consistent
13401340
* view of activity, we query the GuC state only if gt is awake.
13411341
*/
1342-
wakeref = in_reset ? 0 : intel_gt_pm_get_if_awake(gt);
1342+
wakeref = in_reset ? NULL : intel_gt_pm_get_if_awake(gt);
13431343
if (wakeref) {
13441344
stats_saved = *stats;
13451345
gt_stamp_saved = guc->timestamp.gt_stamp;

drivers/gpu/drm/i915/i915_vma.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2157,7 +2157,7 @@ static struct dma_fence *__i915_vma_unbind_async(struct i915_vma *vma)
21572157
int i915_vma_unbind(struct i915_vma *vma)
21582158
{
21592159
struct i915_address_space *vm = vma->vm;
2160-
intel_wakeref_t wakeref = 0;
2160+
intel_wakeref_t wakeref = NULL;
21612161
int err;
21622162

21632163
assert_object_held_shared(vma->obj);
@@ -2196,7 +2196,7 @@ int i915_vma_unbind_async(struct i915_vma *vma, bool trylock_vm)
21962196
{
21972197
struct drm_i915_gem_object *obj = vma->obj;
21982198
struct i915_address_space *vm = vma->vm;
2199-
intel_wakeref_t wakeref = 0;
2199+
intel_wakeref_t wakeref = NULL;
22002200
struct dma_fence *fence;
22012201
int err;
22022202

0 commit comments

Comments
 (0)