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

drm/amd: make a type-safe cgs_device struct. (v2)

This is just a type-safety things to avoid everyone taking void *,
it doesn't change anything.

v2: agd5f: split out the dal changes into a separate patch.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Dave Airlie and committed by
Alex Deucher
110e6f26 c0365541

+93 -98
+1 -1
drivers/gpu/drm/amd/acp/acp_hw.c
··· 34 34 35 35 #define mmACP_AZALIA_I2S_SELECT 0x51d4 36 36 37 - int amd_acp_hw_init(void *cgs_device, 37 + int amd_acp_hw_init(struct cgs_device *cgs_device, 38 38 unsigned acp_version_major, unsigned acp_version_minor) 39 39 { 40 40 unsigned int acp_mode = ACP_MODE_I2S;
+1 -1
drivers/gpu/drm/amd/acp/include/acp_gfx_if.h
··· 28 28 #include "cgs_linux.h" 29 29 #include "cgs_common.h" 30 30 31 - int amd_acp_hw_init(void *cgs_device, 31 + int amd_acp_hw_init(struct cgs_device *cgs_device, 32 32 unsigned acp_version_major, unsigned acp_version_minor); 33 33 34 34 #endif /* _ACP_GFX_IF_H */
+2 -9
drivers/gpu/drm/amd/amdgpu/amdgpu.h
··· 1868 1868 /* 1869 1869 * CGS 1870 1870 */ 1871 - void *amdgpu_cgs_create_device(struct amdgpu_device *adev); 1872 - void amdgpu_cgs_destroy_device(void *cgs_device); 1873 - 1874 - 1875 - /* 1876 - * CGS 1877 - */ 1878 - void *amdgpu_cgs_create_device(struct amdgpu_device *adev); 1879 - void amdgpu_cgs_destroy_device(void *cgs_device); 1871 + struct cgs_device *amdgpu_cgs_create_device(struct amdgpu_device *adev); 1872 + void amdgpu_cgs_destroy_device(struct cgs_device *cgs_device); 1880 1873 1881 1874 1882 1875 /* GPU virtualization */
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.h
··· 30 30 31 31 struct amdgpu_acp { 32 32 struct device *parent; 33 - void *cgs_device; 33 + struct cgs_device *cgs_device; 34 34 struct amd_acp_private *private; 35 35 struct mfd_cell *acp_cell; 36 36 struct resource *acp_res;
+46 -46
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
··· 42 42 struct amdgpu_device *adev = \ 43 43 ((struct amdgpu_cgs_device *)cgs_device)->adev 44 44 45 - static int amdgpu_cgs_gpu_mem_info(void *cgs_device, enum cgs_gpu_mem_type type, 45 + static int amdgpu_cgs_gpu_mem_info(struct cgs_device *cgs_device, enum cgs_gpu_mem_type type, 46 46 uint64_t *mc_start, uint64_t *mc_size, 47 47 uint64_t *mem_size) 48 48 { ··· 73 73 return 0; 74 74 } 75 75 76 - static int amdgpu_cgs_gmap_kmem(void *cgs_device, void *kmem, 76 + static int amdgpu_cgs_gmap_kmem(struct cgs_device *cgs_device, void *kmem, 77 77 uint64_t size, 78 78 uint64_t min_offset, uint64_t max_offset, 79 79 cgs_handle_t *kmem_handle, uint64_t *mcaddr) ··· 102 102 return ret; 103 103 } 104 104 105 - static int amdgpu_cgs_gunmap_kmem(void *cgs_device, cgs_handle_t kmem_handle) 105 + static int amdgpu_cgs_gunmap_kmem(struct cgs_device *cgs_device, cgs_handle_t kmem_handle) 106 106 { 107 107 struct amdgpu_bo *obj = (struct amdgpu_bo *)kmem_handle; 108 108 ··· 118 118 return 0; 119 119 } 120 120 121 - static int amdgpu_cgs_alloc_gpu_mem(void *cgs_device, 121 + static int amdgpu_cgs_alloc_gpu_mem(struct cgs_device *cgs_device, 122 122 enum cgs_gpu_mem_type type, 123 123 uint64_t size, uint64_t align, 124 124 uint64_t min_offset, uint64_t max_offset, ··· 208 208 return ret; 209 209 } 210 210 211 - static int amdgpu_cgs_free_gpu_mem(void *cgs_device, cgs_handle_t handle) 211 + static int amdgpu_cgs_free_gpu_mem(struct cgs_device *cgs_device, cgs_handle_t handle) 212 212 { 213 213 struct amdgpu_bo *obj = (struct amdgpu_bo *)handle; 214 214 ··· 225 225 return 0; 226 226 } 227 227 228 - static int amdgpu_cgs_gmap_gpu_mem(void *cgs_device, cgs_handle_t handle, 228 + static int amdgpu_cgs_gmap_gpu_mem(struct cgs_device *cgs_device, cgs_handle_t handle, 229 229 uint64_t *mcaddr) 230 230 { 231 231 int r; ··· 246 246 return r; 247 247 } 248 248 249 - static int amdgpu_cgs_gunmap_gpu_mem(void *cgs_device, cgs_handle_t handle) 249 + static int amdgpu_cgs_gunmap_gpu_mem(struct cgs_device *cgs_device, cgs_handle_t handle) 250 250 { 251 251 int r; 252 252 struct amdgpu_bo *obj = (struct amdgpu_bo *)handle; ··· 258 258 return r; 259 259 } 260 260 261 - static int amdgpu_cgs_kmap_gpu_mem(void *cgs_device, cgs_handle_t handle, 261 + static int amdgpu_cgs_kmap_gpu_mem(struct cgs_device *cgs_device, cgs_handle_t handle, 262 262 void **map) 263 263 { 264 264 int r; ··· 271 271 return r; 272 272 } 273 273 274 - static int amdgpu_cgs_kunmap_gpu_mem(void *cgs_device, cgs_handle_t handle) 274 + static int amdgpu_cgs_kunmap_gpu_mem(struct cgs_device *cgs_device, cgs_handle_t handle) 275 275 { 276 276 int r; 277 277 struct amdgpu_bo *obj = (struct amdgpu_bo *)handle; ··· 283 283 return r; 284 284 } 285 285 286 - static uint32_t amdgpu_cgs_read_register(void *cgs_device, unsigned offset) 286 + static uint32_t amdgpu_cgs_read_register(struct cgs_device *cgs_device, unsigned offset) 287 287 { 288 288 CGS_FUNC_ADEV; 289 289 return RREG32(offset); 290 290 } 291 291 292 - static void amdgpu_cgs_write_register(void *cgs_device, unsigned offset, 292 + static void amdgpu_cgs_write_register(struct cgs_device *cgs_device, unsigned offset, 293 293 uint32_t value) 294 294 { 295 295 CGS_FUNC_ADEV; 296 296 WREG32(offset, value); 297 297 } 298 298 299 - static uint32_t amdgpu_cgs_read_ind_register(void *cgs_device, 299 + static uint32_t amdgpu_cgs_read_ind_register(struct cgs_device *cgs_device, 300 300 enum cgs_ind_reg space, 301 301 unsigned index) 302 302 { ··· 320 320 return 0; 321 321 } 322 322 323 - static void amdgpu_cgs_write_ind_register(void *cgs_device, 323 + static void amdgpu_cgs_write_ind_register(struct cgs_device *cgs_device, 324 324 enum cgs_ind_reg space, 325 325 unsigned index, uint32_t value) 326 326 { ··· 343 343 WARN(1, "Invalid indirect register space"); 344 344 } 345 345 346 - static uint8_t amdgpu_cgs_read_pci_config_byte(void *cgs_device, unsigned addr) 346 + static uint8_t amdgpu_cgs_read_pci_config_byte(struct cgs_device *cgs_device, unsigned addr) 347 347 { 348 348 CGS_FUNC_ADEV; 349 349 uint8_t val; ··· 353 353 return val; 354 354 } 355 355 356 - static uint16_t amdgpu_cgs_read_pci_config_word(void *cgs_device, unsigned addr) 356 + static uint16_t amdgpu_cgs_read_pci_config_word(struct cgs_device *cgs_device, unsigned addr) 357 357 { 358 358 CGS_FUNC_ADEV; 359 359 uint16_t val; ··· 363 363 return val; 364 364 } 365 365 366 - static uint32_t amdgpu_cgs_read_pci_config_dword(void *cgs_device, 366 + static uint32_t amdgpu_cgs_read_pci_config_dword(struct cgs_device *cgs_device, 367 367 unsigned addr) 368 368 { 369 369 CGS_FUNC_ADEV; ··· 374 374 return val; 375 375 } 376 376 377 - static void amdgpu_cgs_write_pci_config_byte(void *cgs_device, unsigned addr, 377 + static void amdgpu_cgs_write_pci_config_byte(struct cgs_device *cgs_device, unsigned addr, 378 378 uint8_t value) 379 379 { 380 380 CGS_FUNC_ADEV; ··· 382 382 WARN(ret, "pci_write_config_byte error"); 383 383 } 384 384 385 - static void amdgpu_cgs_write_pci_config_word(void *cgs_device, unsigned addr, 385 + static void amdgpu_cgs_write_pci_config_word(struct cgs_device *cgs_device, unsigned addr, 386 386 uint16_t value) 387 387 { 388 388 CGS_FUNC_ADEV; ··· 390 390 WARN(ret, "pci_write_config_word error"); 391 391 } 392 392 393 - static void amdgpu_cgs_write_pci_config_dword(void *cgs_device, unsigned addr, 393 + static void amdgpu_cgs_write_pci_config_dword(struct cgs_device *cgs_device, unsigned addr, 394 394 uint32_t value) 395 395 { 396 396 CGS_FUNC_ADEV; ··· 399 399 } 400 400 401 401 402 - static int amdgpu_cgs_get_pci_resource(void *cgs_device, 402 + static int amdgpu_cgs_get_pci_resource(struct cgs_device *cgs_device, 403 403 enum cgs_resource_type resource_type, 404 404 uint64_t size, 405 405 uint64_t offset, ··· 433 433 } 434 434 } 435 435 436 - static const void *amdgpu_cgs_atom_get_data_table(void *cgs_device, 436 + static const void *amdgpu_cgs_atom_get_data_table(struct cgs_device *cgs_device, 437 437 unsigned table, uint16_t *size, 438 438 uint8_t *frev, uint8_t *crev) 439 439 { ··· 449 449 return NULL; 450 450 } 451 451 452 - static int amdgpu_cgs_atom_get_cmd_table_revs(void *cgs_device, unsigned table, 452 + static int amdgpu_cgs_atom_get_cmd_table_revs(struct cgs_device *cgs_device, unsigned table, 453 453 uint8_t *frev, uint8_t *crev) 454 454 { 455 455 CGS_FUNC_ADEV; ··· 462 462 return -EINVAL; 463 463 } 464 464 465 - static int amdgpu_cgs_atom_exec_cmd_table(void *cgs_device, unsigned table, 465 + static int amdgpu_cgs_atom_exec_cmd_table(struct cgs_device *cgs_device, unsigned table, 466 466 void *args) 467 467 { 468 468 CGS_FUNC_ADEV; ··· 471 471 adev->mode_info.atom_context, table, args); 472 472 } 473 473 474 - static int amdgpu_cgs_create_pm_request(void *cgs_device, cgs_handle_t *request) 474 + static int amdgpu_cgs_create_pm_request(struct cgs_device *cgs_device, cgs_handle_t *request) 475 475 { 476 476 /* TODO */ 477 477 return 0; 478 478 } 479 479 480 - static int amdgpu_cgs_destroy_pm_request(void *cgs_device, cgs_handle_t request) 480 + static int amdgpu_cgs_destroy_pm_request(struct cgs_device *cgs_device, cgs_handle_t request) 481 481 { 482 482 /* TODO */ 483 483 return 0; 484 484 } 485 485 486 - static int amdgpu_cgs_set_pm_request(void *cgs_device, cgs_handle_t request, 486 + static int amdgpu_cgs_set_pm_request(struct cgs_device *cgs_device, cgs_handle_t request, 487 487 int active) 488 488 { 489 489 /* TODO */ 490 490 return 0; 491 491 } 492 492 493 - static int amdgpu_cgs_pm_request_clock(void *cgs_device, cgs_handle_t request, 493 + static int amdgpu_cgs_pm_request_clock(struct cgs_device *cgs_device, cgs_handle_t request, 494 494 enum cgs_clock clock, unsigned freq) 495 495 { 496 496 /* TODO */ 497 497 return 0; 498 498 } 499 499 500 - static int amdgpu_cgs_pm_request_engine(void *cgs_device, cgs_handle_t request, 500 + static int amdgpu_cgs_pm_request_engine(struct cgs_device *cgs_device, cgs_handle_t request, 501 501 enum cgs_engine engine, int powered) 502 502 { 503 503 /* TODO */ ··· 506 506 507 507 508 508 509 - static int amdgpu_cgs_pm_query_clock_limits(void *cgs_device, 509 + static int amdgpu_cgs_pm_query_clock_limits(struct cgs_device *cgs_device, 510 510 enum cgs_clock clock, 511 511 struct cgs_clock_limits *limits) 512 512 { ··· 514 514 return 0; 515 515 } 516 516 517 - static int amdgpu_cgs_set_camera_voltages(void *cgs_device, uint32_t mask, 517 + static int amdgpu_cgs_set_camera_voltages(struct cgs_device *cgs_device, uint32_t mask, 518 518 const uint32_t *voltages) 519 519 { 520 520 DRM_ERROR("not implemented"); ··· 565 565 .process = cgs_process_irq, 566 566 }; 567 567 568 - static int amdgpu_cgs_add_irq_source(void *cgs_device, unsigned src_id, 568 + static int amdgpu_cgs_add_irq_source(struct cgs_device *cgs_device, unsigned src_id, 569 569 unsigned num_types, 570 570 cgs_irq_source_set_func_t set, 571 571 cgs_irq_handler_func_t handler, ··· 600 600 return ret; 601 601 } 602 602 603 - static int amdgpu_cgs_irq_get(void *cgs_device, unsigned src_id, unsigned type) 603 + static int amdgpu_cgs_irq_get(struct cgs_device *cgs_device, unsigned src_id, unsigned type) 604 604 { 605 605 CGS_FUNC_ADEV; 606 606 return amdgpu_irq_get(adev, adev->irq.sources[src_id], type); 607 607 } 608 608 609 - static int amdgpu_cgs_irq_put(void *cgs_device, unsigned src_id, unsigned type) 609 + static int amdgpu_cgs_irq_put(struct cgs_device *cgs_device, unsigned src_id, unsigned type) 610 610 { 611 611 CGS_FUNC_ADEV; 612 612 return amdgpu_irq_put(adev, adev->irq.sources[src_id], type); 613 613 } 614 614 615 - int amdgpu_cgs_set_clockgating_state(void *cgs_device, 615 + int amdgpu_cgs_set_clockgating_state(struct cgs_device *cgs_device, 616 616 enum amd_ip_block_type block_type, 617 617 enum amd_clockgating_state state) 618 618 { ··· 633 633 return r; 634 634 } 635 635 636 - int amdgpu_cgs_set_powergating_state(void *cgs_device, 636 + int amdgpu_cgs_set_powergating_state(struct cgs_device *cgs_device, 637 637 enum amd_ip_block_type block_type, 638 638 enum amd_powergating_state state) 639 639 { ··· 655 655 } 656 656 657 657 658 - static uint32_t fw_type_convert(void *cgs_device, uint32_t fw_type) 658 + static uint32_t fw_type_convert(struct cgs_device *cgs_device, uint32_t fw_type) 659 659 { 660 660 CGS_FUNC_ADEV; 661 661 enum AMDGPU_UCODE_ID result = AMDGPU_UCODE_ID_MAXIMUM; ··· 695 695 return result; 696 696 } 697 697 698 - static int amdgpu_cgs_get_firmware_info(void *cgs_device, 698 + static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device, 699 699 enum cgs_ucode_id type, 700 700 struct cgs_firmware_info *info) 701 701 { ··· 774 774 return 0; 775 775 } 776 776 777 - static int amdgpu_cgs_query_system_info(void *cgs_device, 777 + static int amdgpu_cgs_query_system_info(struct cgs_device *cgs_device, 778 778 struct cgs_system_info *sys_info) 779 779 { 780 780 CGS_FUNC_ADEV; ··· 808 808 return 0; 809 809 } 810 810 811 - static int amdgpu_cgs_get_active_displays_info(void *cgs_device, 811 + static int amdgpu_cgs_get_active_displays_info(struct cgs_device *cgs_device, 812 812 struct cgs_display_info *info) 813 813 { 814 814 CGS_FUNC_ADEV; ··· 851 851 } 852 852 853 853 854 - static int amdgpu_cgs_notify_dpm_enabled(void *cgs_device, bool enabled) 854 + static int amdgpu_cgs_notify_dpm_enabled(struct cgs_device *cgs_device, bool enabled) 855 855 { 856 856 CGS_FUNC_ADEV; 857 857 ··· 867 867 */ 868 868 869 869 #if defined(CONFIG_ACPI) 870 - static int amdgpu_cgs_acpi_eval_object(void *cgs_device, 870 + static int amdgpu_cgs_acpi_eval_object(struct cgs_device *cgs_device, 871 871 struct cgs_acpi_method_info *info) 872 872 { 873 873 CGS_FUNC_ADEV; ··· 1030 1030 return result; 1031 1031 } 1032 1032 #else 1033 - static int amdgpu_cgs_acpi_eval_object(void *cgs_device, 1033 + static int amdgpu_cgs_acpi_eval_object(struct cgs_device *cgs_device, 1034 1034 struct cgs_acpi_method_info *info) 1035 1035 { 1036 1036 return -EIO; 1037 1037 } 1038 1038 #endif 1039 1039 1040 - int amdgpu_cgs_call_acpi_method(void *cgs_device, 1040 + int amdgpu_cgs_call_acpi_method(struct cgs_device *cgs_device, 1041 1041 uint32_t acpi_method, 1042 1042 uint32_t acpi_function, 1043 1043 void *pinput, void *poutput, ··· 1121 1121 amdgpu_cgs_irq_put 1122 1122 }; 1123 1123 1124 - void *amdgpu_cgs_create_device(struct amdgpu_device *adev) 1124 + struct cgs_device *amdgpu_cgs_create_device(struct amdgpu_device *adev) 1125 1125 { 1126 1126 struct amdgpu_cgs_device *cgs_device = 1127 1127 kmalloc(sizeof(*cgs_device), GFP_KERNEL); ··· 1135 1135 cgs_device->base.os_ops = &amdgpu_cgs_os_ops; 1136 1136 cgs_device->adev = adev; 1137 1137 1138 - return cgs_device; 1138 + return (struct cgs_device *)cgs_device; 1139 1139 } 1140 1140 1141 - void amdgpu_cgs_destroy_device(void *cgs_device) 1141 + void amdgpu_cgs_destroy_device(struct cgs_device *cgs_device) 1142 1142 { 1143 1143 kfree(cgs_device); 1144 1144 }
+39 -37
drivers/gpu/drm/amd/include/cgs_common.h
··· 26 26 27 27 #include "amd_shared.h" 28 28 29 + struct cgs_device; 30 + 29 31 /** 30 32 * enum cgs_gpu_mem_type - GPU memory types 31 33 */ ··· 225 223 * 226 224 * Return: 0 on success, -errno otherwise 227 225 */ 228 - typedef int (*cgs_gpu_mem_info_t)(void *cgs_device, enum cgs_gpu_mem_type type, 226 + typedef int (*cgs_gpu_mem_info_t)(struct cgs_device *cgs_device, enum cgs_gpu_mem_type type, 229 227 uint64_t *mc_start, uint64_t *mc_size, 230 228 uint64_t *mem_size); 231 229 ··· 241 239 * 242 240 * Return: 0 on success, -errno otherwise 243 241 */ 244 - typedef int (*cgs_gmap_kmem_t)(void *cgs_device, void *kmem, uint64_t size, 242 + typedef int (*cgs_gmap_kmem_t)(struct cgs_device *cgs_device, void *kmem, uint64_t size, 245 243 uint64_t min_offset, uint64_t max_offset, 246 244 cgs_handle_t *kmem_handle, uint64_t *mcaddr); 247 245 ··· 252 250 * 253 251 * Return: 0 on success, -errno otherwise 254 252 */ 255 - typedef int (*cgs_gunmap_kmem_t)(void *cgs_device, cgs_handle_t kmem_handle); 253 + typedef int (*cgs_gunmap_kmem_t)(struct cgs_device *cgs_device, cgs_handle_t kmem_handle); 256 254 257 255 /** 258 256 * cgs_alloc_gpu_mem() - Allocate GPU memory ··· 281 279 * 282 280 * Return: 0 on success, -errno otherwise 283 281 */ 284 - typedef int (*cgs_alloc_gpu_mem_t)(void *cgs_device, enum cgs_gpu_mem_type type, 282 + typedef int (*cgs_alloc_gpu_mem_t)(struct cgs_device *cgs_device, enum cgs_gpu_mem_type type, 285 283 uint64_t size, uint64_t align, 286 284 uint64_t min_offset, uint64_t max_offset, 287 285 cgs_handle_t *handle); ··· 293 291 * 294 292 * Return: 0 on success, -errno otherwise 295 293 */ 296 - typedef int (*cgs_free_gpu_mem_t)(void *cgs_device, cgs_handle_t handle); 294 + typedef int (*cgs_free_gpu_mem_t)(struct cgs_device *cgs_device, cgs_handle_t handle); 297 295 298 296 /** 299 297 * cgs_gmap_gpu_mem() - GPU-map GPU memory ··· 305 303 * 306 304 * Return: 0 on success, -errno otherwise 307 305 */ 308 - typedef int (*cgs_gmap_gpu_mem_t)(void *cgs_device, cgs_handle_t handle, 306 + typedef int (*cgs_gmap_gpu_mem_t)(struct cgs_device *cgs_device, cgs_handle_t handle, 309 307 uint64_t *mcaddr); 310 308 311 309 /** ··· 317 315 * 318 316 * Return: 0 on success, -errno otherwise 319 317 */ 320 - typedef int (*cgs_gunmap_gpu_mem_t)(void *cgs_device, cgs_handle_t handle); 318 + typedef int (*cgs_gunmap_gpu_mem_t)(struct cgs_device *cgs_device, cgs_handle_t handle); 321 319 322 320 /** 323 321 * cgs_kmap_gpu_mem() - Kernel-map GPU memory ··· 328 326 * 329 327 * Return: 0 on success, -errno otherwise 330 328 */ 331 - typedef int (*cgs_kmap_gpu_mem_t)(void *cgs_device, cgs_handle_t handle, 329 + typedef int (*cgs_kmap_gpu_mem_t)(struct cgs_device *cgs_device, cgs_handle_t handle, 332 330 void **map); 333 331 334 332 /** ··· 338 336 * 339 337 * Return: 0 on success, -errno otherwise 340 338 */ 341 - typedef int (*cgs_kunmap_gpu_mem_t)(void *cgs_device, cgs_handle_t handle); 339 + typedef int (*cgs_kunmap_gpu_mem_t)(struct cgs_device *cgs_device, cgs_handle_t handle); 342 340 343 341 /** 344 342 * cgs_read_register() - Read an MMIO register ··· 347 345 * 348 346 * Return: register value 349 347 */ 350 - typedef uint32_t (*cgs_read_register_t)(void *cgs_device, unsigned offset); 348 + typedef uint32_t (*cgs_read_register_t)(struct cgs_device *cgs_device, unsigned offset); 351 349 352 350 /** 353 351 * cgs_write_register() - Write an MMIO register ··· 355 353 * @offset: register offset 356 354 * @value: register value 357 355 */ 358 - typedef void (*cgs_write_register_t)(void *cgs_device, unsigned offset, 356 + typedef void (*cgs_write_register_t)(struct cgs_device *cgs_device, unsigned offset, 359 357 uint32_t value); 360 358 361 359 /** ··· 365 363 * 366 364 * Return: register value 367 365 */ 368 - typedef uint32_t (*cgs_read_ind_register_t)(void *cgs_device, enum cgs_ind_reg space, 366 + typedef uint32_t (*cgs_read_ind_register_t)(struct cgs_device *cgs_device, enum cgs_ind_reg space, 369 367 unsigned index); 370 368 371 369 /** ··· 374 372 * @offset: register offset 375 373 * @value: register value 376 374 */ 377 - typedef void (*cgs_write_ind_register_t)(void *cgs_device, enum cgs_ind_reg space, 375 + typedef void (*cgs_write_ind_register_t)(struct cgs_device *cgs_device, enum cgs_ind_reg space, 378 376 unsigned index, uint32_t value); 379 377 380 378 /** ··· 384 382 * 385 383 * Return: Value read 386 384 */ 387 - typedef uint8_t (*cgs_read_pci_config_byte_t)(void *cgs_device, unsigned addr); 385 + typedef uint8_t (*cgs_read_pci_config_byte_t)(struct cgs_device *cgs_device, unsigned addr); 388 386 389 387 /** 390 388 * cgs_read_pci_config_word() - Read word from PCI configuration space ··· 393 391 * 394 392 * Return: Value read 395 393 */ 396 - typedef uint16_t (*cgs_read_pci_config_word_t)(void *cgs_device, unsigned addr); 394 + typedef uint16_t (*cgs_read_pci_config_word_t)(struct cgs_device *cgs_device, unsigned addr); 397 395 398 396 /** 399 397 * cgs_read_pci_config_dword() - Read dword from PCI configuration space ··· 402 400 * 403 401 * Return: Value read 404 402 */ 405 - typedef uint32_t (*cgs_read_pci_config_dword_t)(void *cgs_device, 403 + typedef uint32_t (*cgs_read_pci_config_dword_t)(struct cgs_device *cgs_device, 406 404 unsigned addr); 407 405 408 406 /** ··· 411 409 * @addr: address 412 410 * @value: value to write 413 411 */ 414 - typedef void (*cgs_write_pci_config_byte_t)(void *cgs_device, unsigned addr, 412 + typedef void (*cgs_write_pci_config_byte_t)(struct cgs_device *cgs_device, unsigned addr, 415 413 uint8_t value); 416 414 417 415 /** ··· 420 418 * @addr: address, must be word-aligned 421 419 * @value: value to write 422 420 */ 423 - typedef void (*cgs_write_pci_config_word_t)(void *cgs_device, unsigned addr, 421 + typedef void (*cgs_write_pci_config_word_t)(struct cgs_device *cgs_device, unsigned addr, 424 422 uint16_t value); 425 423 426 424 /** ··· 429 427 * @addr: address, must be dword-aligned 430 428 * @value: value to write 431 429 */ 432 - typedef void (*cgs_write_pci_config_dword_t)(void *cgs_device, unsigned addr, 430 + typedef void (*cgs_write_pci_config_dword_t)(struct cgs_device *cgs_device, unsigned addr, 433 431 uint32_t value); 434 432 435 433 ··· 443 441 * 444 442 * Return: 0 on success, -errno otherwise 445 443 */ 446 - typedef int (*cgs_get_pci_resource_t)(void *cgs_device, 444 + typedef int (*cgs_get_pci_resource_t)(struct cgs_device *cgs_device, 447 445 enum cgs_resource_type resource_type, 448 446 uint64_t size, 449 447 uint64_t offset, ··· 460 458 * Return: Pointer to start of the table, or NULL on failure 461 459 */ 462 460 typedef const void *(*cgs_atom_get_data_table_t)( 463 - void *cgs_device, unsigned table, 461 + struct cgs_device *cgs_device, unsigned table, 464 462 uint16_t *size, uint8_t *frev, uint8_t *crev); 465 463 466 464 /** ··· 472 470 * 473 471 * Return: 0 on success, -errno otherwise 474 472 */ 475 - typedef int (*cgs_atom_get_cmd_table_revs_t)(void *cgs_device, unsigned table, 473 + typedef int (*cgs_atom_get_cmd_table_revs_t)(struct cgs_device *cgs_device, unsigned table, 476 474 uint8_t *frev, uint8_t *crev); 477 475 478 476 /** ··· 483 481 * 484 482 * Return: 0 on success, -errno otherwise 485 483 */ 486 - typedef int (*cgs_atom_exec_cmd_table_t)(void *cgs_device, 484 + typedef int (*cgs_atom_exec_cmd_table_t)(struct cgs_device *cgs_device, 487 485 unsigned table, void *args); 488 486 489 487 /** ··· 493 491 * 494 492 * Return: 0 on success, -errno otherwise 495 493 */ 496 - typedef int (*cgs_create_pm_request_t)(void *cgs_device, cgs_handle_t *request); 494 + typedef int (*cgs_create_pm_request_t)(struct cgs_device *cgs_device, cgs_handle_t *request); 497 495 498 496 /** 499 497 * cgs_destroy_pm_request() - Destroy a power management request ··· 502 500 * 503 501 * Return: 0 on success, -errno otherwise 504 502 */ 505 - typedef int (*cgs_destroy_pm_request_t)(void *cgs_device, cgs_handle_t request); 503 + typedef int (*cgs_destroy_pm_request_t)(struct cgs_device *cgs_device, cgs_handle_t request); 506 504 507 505 /** 508 506 * cgs_set_pm_request() - Activate or deactiveate a PM request ··· 518 516 * 519 517 * Return: 0 on success, -errno otherwise 520 518 */ 521 - typedef int (*cgs_set_pm_request_t)(void *cgs_device, cgs_handle_t request, 519 + typedef int (*cgs_set_pm_request_t)(struct cgs_device *cgs_device, cgs_handle_t request, 522 520 int active); 523 521 524 522 /** ··· 530 528 * 531 529 * Return: 0 on success, -errno otherwise 532 530 */ 533 - typedef int (*cgs_pm_request_clock_t)(void *cgs_device, cgs_handle_t request, 531 + typedef int (*cgs_pm_request_clock_t)(struct cgs_device *cgs_device, cgs_handle_t request, 534 532 enum cgs_clock clock, unsigned freq); 535 533 536 534 /** ··· 542 540 * 543 541 * Return: 0 on success, -errno otherwise 544 542 */ 545 - typedef int (*cgs_pm_request_engine_t)(void *cgs_device, cgs_handle_t request, 543 + typedef int (*cgs_pm_request_engine_t)(struct cgs_device *cgs_device, cgs_handle_t request, 546 544 enum cgs_engine engine, int powered); 547 545 548 546 /** ··· 553 551 * 554 552 * Return: 0 on success, -errno otherwise 555 553 */ 556 - typedef int (*cgs_pm_query_clock_limits_t)(void *cgs_device, 554 + typedef int (*cgs_pm_query_clock_limits_t)(struct cgs_device *cgs_device, 557 555 enum cgs_clock clock, 558 556 struct cgs_clock_limits *limits); 559 557 ··· 565 563 * 566 564 * Return: 0 on success, -errno otherwise 567 565 */ 568 - typedef int (*cgs_set_camera_voltages_t)(void *cgs_device, uint32_t mask, 566 + typedef int (*cgs_set_camera_voltages_t)(struct cgs_device *cgs_device, uint32_t mask, 569 567 const uint32_t *voltages); 570 568 /** 571 569 * cgs_get_firmware_info - Get the firmware information from core driver ··· 575 573 * 576 574 * Return: 0 on success, -errno otherwise 577 575 */ 578 - typedef int (*cgs_get_firmware_info)(void *cgs_device, 576 + typedef int (*cgs_get_firmware_info)(struct cgs_device *cgs_device, 579 577 enum cgs_ucode_id type, 580 578 struct cgs_firmware_info *info); 581 579 582 - typedef int(*cgs_set_powergating_state)(void *cgs_device, 580 + typedef int(*cgs_set_powergating_state)(struct cgs_device *cgs_device, 583 581 enum amd_ip_block_type block_type, 584 582 enum amd_powergating_state state); 585 583 586 - typedef int(*cgs_set_clockgating_state)(void *cgs_device, 584 + typedef int(*cgs_set_clockgating_state)(struct cgs_device *cgs_device, 587 585 enum amd_ip_block_type block_type, 588 586 enum amd_clockgating_state state); 589 587 590 588 typedef int(*cgs_get_active_displays_info)( 591 - void *cgs_device, 589 + struct cgs_device *cgs_device, 592 590 struct cgs_display_info *info); 593 591 594 - typedef int (*cgs_notify_dpm_enabled)(void *cgs_device, bool enabled); 592 + typedef int (*cgs_notify_dpm_enabled)(struct cgs_device *cgs_device, bool enabled); 595 593 596 - typedef int (*cgs_call_acpi_method)(void *cgs_device, 594 + typedef int (*cgs_call_acpi_method)(struct cgs_device *cgs_device, 597 595 uint32_t acpi_method, 598 596 uint32_t acpi_function, 599 597 void *pinput, void *poutput, ··· 601 599 uint32_t input_size, 602 600 uint32_t output_size); 603 601 604 - typedef int (*cgs_query_system_info)(void *cgs_device, 602 + typedef int (*cgs_query_system_info)(struct cgs_device *cgs_device, 605 603 struct cgs_system_info *sys_info); 606 604 607 605 struct cgs_ops {
+3 -3
drivers/gpu/drm/amd/include/cgs_linux.h
··· 66 66 * 67 67 * Return: 0 on success, -errno otherwise 68 68 */ 69 - typedef int (*cgs_add_irq_source_t)(void *cgs_device, unsigned src_id, 69 + typedef int (*cgs_add_irq_source_t)(struct cgs_device *cgs_device, unsigned src_id, 70 70 unsigned num_types, 71 71 cgs_irq_source_set_func_t set, 72 72 cgs_irq_handler_func_t handler, ··· 83 83 * 84 84 * Return: 0 on success, -errno otherwise 85 85 */ 86 - typedef int (*cgs_irq_get_t)(void *cgs_device, unsigned src_id, unsigned type); 86 + typedef int (*cgs_irq_get_t)(struct cgs_device *cgs_device, unsigned src_id, unsigned type); 87 87 88 88 /** 89 89 * cgs_irq_put() - Indicate IRQ source is no longer needed ··· 98 98 * 99 99 * Return: 0 on success, -errno otherwise 100 100 */ 101 - typedef int (*cgs_irq_put_t)(void *cgs_device, unsigned src_id, unsigned type); 101 + typedef int (*cgs_irq_put_t)(struct cgs_device *cgs_device, unsigned src_id, unsigned type); 102 102 103 103 struct cgs_os_ops { 104 104 /* IRQ handling */