Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/lima: fix void pointer to enum lima_gpu_id cast warning

Create a simple data struct to hold compatible data so that we don't
have to do the casts to void pointer to hold data.
Fixes the following warning:
drivers/gpu/drm/lima/lima_drv.c:387:13: error: cast to smaller integer
type 'enum lima_gpu_id' from 'const void *'

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240401224329.1228468-3-nunes.erico@gmail.com

authored by

Erico Nunes and committed by
Qiang Yu
b27a838f a6683c69

+23 -3
+18 -3
drivers/gpu/drm/lima/lima_drv.c
··· 371 371 { 372 372 struct lima_device *ldev; 373 373 struct drm_device *ddev; 374 + const struct lima_compatible *comp; 374 375 int err; 375 376 376 377 err = lima_sched_slab_init(); ··· 385 384 } 386 385 387 386 ldev->dev = &pdev->dev; 388 - ldev->id = (enum lima_gpu_id)of_device_get_match_data(&pdev->dev); 387 + comp = of_device_get_match_data(&pdev->dev); 388 + if (!comp) { 389 + err = -ENODEV; 390 + goto err_out0; 391 + } 392 + 393 + ldev->id = comp->id; 389 394 390 395 platform_set_drvdata(pdev, ldev); 391 396 ··· 466 459 lima_sched_slab_fini(); 467 460 } 468 461 462 + static const struct lima_compatible lima_mali400_data = { 463 + .id = lima_gpu_mali400, 464 + }; 465 + 466 + static const struct lima_compatible lima_mali450_data = { 467 + .id = lima_gpu_mali450, 468 + }; 469 + 469 470 static const struct of_device_id dt_match[] = { 470 - { .compatible = "arm,mali-400", .data = (void *)lima_gpu_mali400 }, 471 - { .compatible = "arm,mali-450", .data = (void *)lima_gpu_mali450 }, 471 + { .compatible = "arm,mali-400", .data = &lima_mali400_data }, 472 + { .compatible = "arm,mali-450", .data = &lima_mali450_data }, 472 473 {} 473 474 }; 474 475 MODULE_DEVICE_TABLE(of, dt_match);
+5
drivers/gpu/drm/lima/lima_drv.h
··· 7 7 #include <drm/drm_file.h> 8 8 9 9 #include "lima_ctx.h" 10 + #include "lima_device.h" 10 11 11 12 extern int lima_sched_timeout_ms; 12 13 extern uint lima_heap_init_nr_pages; ··· 38 37 u32 out_sync; 39 38 40 39 struct lima_sched_task *task; 40 + }; 41 + 42 + struct lima_compatible { 43 + enum lima_gpu_id id; 41 44 }; 42 45 43 46 static inline struct lima_drm_priv *