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.

coresight: change helper_ops to accept coresight_path

Update the helper_enable and helper_disable functions to accept
coresight_path instead of a generic void *data, as coresight_path
encapsulates all the necessary data required by devices along the path.

Tested-by: Carl Worth <carl@os.amperecomputing.com>
Reviewed-by: Carl Worth <carl@os.amperecomputing.com>
Reviewed-by: Leo Yan <leo.yan@arm.com>
Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20250925-fix_helper_data-v2-2-edd8a07c1646@oss.qualcomm.com

authored by

Jie Gan and committed by
Suzuki K Poulose
94baedb5 aaa5abcc

+33 -28
+5 -5
drivers/hwtracing/coresight/coresight-catu.c
··· 397 397 } 398 398 399 399 static int catu_enable_hw(struct catu_drvdata *drvdata, enum cs_mode cs_mode, 400 - void *data) 400 + struct coresight_path *path) 401 401 { 402 402 int rc; 403 403 u32 control, mode; ··· 425 425 etrdev = coresight_find_input_type( 426 426 csdev->pdata, CORESIGHT_DEV_TYPE_SINK, etr_subtype); 427 427 if (etrdev) { 428 - etr_buf = tmc_etr_get_buffer(etrdev, cs_mode, data); 428 + etr_buf = tmc_etr_get_buffer(etrdev, cs_mode, path); 429 429 if (IS_ERR(etr_buf)) 430 430 return PTR_ERR(etr_buf); 431 431 } ··· 455 455 } 456 456 457 457 static int catu_enable(struct coresight_device *csdev, enum cs_mode mode, 458 - void *data) 458 + struct coresight_path *path) 459 459 { 460 460 int rc = 0; 461 461 struct catu_drvdata *catu_drvdata = csdev_to_catu_drvdata(csdev); ··· 463 463 guard(raw_spinlock_irqsave)(&catu_drvdata->spinlock); 464 464 if (csdev->refcnt == 0) { 465 465 CS_UNLOCK(catu_drvdata->base); 466 - rc = catu_enable_hw(catu_drvdata, mode, data); 466 + rc = catu_enable_hw(catu_drvdata, mode, path); 467 467 CS_LOCK(catu_drvdata->base); 468 468 } 469 469 if (!rc) ··· 488 488 return rc; 489 489 } 490 490 491 - static int catu_disable(struct coresight_device *csdev, void *__unused) 491 + static int catu_disable(struct coresight_device *csdev, struct coresight_path *path) 492 492 { 493 493 int rc = 0; 494 494 struct catu_drvdata *catu_drvdata = csdev_to_catu_drvdata(csdev);
+12 -8
drivers/hwtracing/coresight/coresight-core.c
··· 355 355 } 356 356 357 357 static int coresight_enable_helper(struct coresight_device *csdev, 358 - enum cs_mode mode, void *data) 358 + enum cs_mode mode, 359 + struct coresight_path *path) 359 360 { 360 - return helper_ops(csdev)->enable(csdev, mode, data); 361 + return helper_ops(csdev)->enable(csdev, mode, path); 361 362 } 362 363 363 - static void coresight_disable_helper(struct coresight_device *csdev, void *data) 364 + static void coresight_disable_helper(struct coresight_device *csdev, 365 + struct coresight_path *path) 364 366 { 365 - helper_ops(csdev)->disable(csdev, data); 367 + helper_ops(csdev)->disable(csdev, path); 366 368 } 367 369 368 - static void coresight_disable_helpers(struct coresight_device *csdev, void *data) 370 + static void coresight_disable_helpers(struct coresight_device *csdev, 371 + struct coresight_path *path) 369 372 { 370 373 int i; 371 374 struct coresight_device *helper; ··· 376 373 for (i = 0; i < csdev->pdata->nr_outconns; ++i) { 377 374 helper = csdev->pdata->out_conns[i]->dest_dev; 378 375 if (helper && coresight_is_helper(helper)) 379 - coresight_disable_helper(helper, data); 376 + coresight_disable_helper(helper, path); 380 377 } 381 378 } 382 379 ··· 482 479 EXPORT_SYMBOL_GPL(coresight_disable_path); 483 480 484 481 static int coresight_enable_helpers(struct coresight_device *csdev, 485 - enum cs_mode mode, void *data) 482 + enum cs_mode mode, 483 + struct coresight_path *path) 486 484 { 487 485 int i, ret = 0; 488 486 struct coresight_device *helper; ··· 493 489 if (!helper || !coresight_is_helper(helper)) 494 490 continue; 495 491 496 - ret = coresight_enable_helper(helper, mode, data); 492 + ret = coresight_enable_helper(helper, mode, path); 497 493 if (ret) 498 494 return ret; 499 495 }
+3 -6
drivers/hwtracing/coresight/coresight-ctcu-core.c
··· 156 156 return __ctcu_set_etr_traceid(csdev, traceid, port_num, enable); 157 157 } 158 158 159 - static int ctcu_enable(struct coresight_device *csdev, enum cs_mode mode, void *data) 159 + static int ctcu_enable(struct coresight_device *csdev, enum cs_mode mode, 160 + struct coresight_path *path) 160 161 { 161 - struct coresight_path *path = (struct coresight_path *)data; 162 - 163 162 return ctcu_set_etr_traceid(csdev, path, true); 164 163 } 165 164 166 - static int ctcu_disable(struct coresight_device *csdev, void *data) 165 + static int ctcu_disable(struct coresight_device *csdev, struct coresight_path *path) 167 166 { 168 - struct coresight_path *path = (struct coresight_path *)data; 169 - 170 167 return ctcu_set_etr_traceid(csdev, path, false); 171 168 } 172 169
+3 -2
drivers/hwtracing/coresight/coresight-cti-core.c
··· 799 799 } 800 800 801 801 /** cti ect operations **/ 802 - int cti_enable(struct coresight_device *csdev, enum cs_mode mode, void *data) 802 + int cti_enable(struct coresight_device *csdev, enum cs_mode mode, 803 + struct coresight_path *path) 803 804 { 804 805 struct cti_drvdata *drvdata = csdev_to_cti_drvdata(csdev); 805 806 806 807 return cti_enable_hw(drvdata); 807 808 } 808 809 809 - int cti_disable(struct coresight_device *csdev, void *data) 810 + int cti_disable(struct coresight_device *csdev, struct coresight_path *path) 810 811 { 811 812 struct cti_drvdata *drvdata = csdev_to_cti_drvdata(csdev); 812 813
+3 -2
drivers/hwtracing/coresight/coresight-cti.h
··· 216 216 const char *assoc_dev_name); 217 217 struct cti_trig_con *cti_allocate_trig_con(struct device *dev, int in_sigs, 218 218 int out_sigs); 219 - int cti_enable(struct coresight_device *csdev, enum cs_mode mode, void *data); 220 - int cti_disable(struct coresight_device *csdev, void *data); 219 + int cti_enable(struct coresight_device *csdev, enum cs_mode mode, 220 + struct coresight_path *path); 221 + int cti_disable(struct coresight_device *csdev, struct coresight_path *path); 221 222 void cti_write_all_hw_regs(struct cti_drvdata *drvdata); 222 223 void cti_write_intack(struct device *dev, u32 ackval); 223 224 void cti_write_single_reg(struct cti_drvdata *drvdata, int offset, u32 value);
+2 -2
drivers/hwtracing/coresight/coresight-tmc-etr.c
··· 1332 1332 } 1333 1333 1334 1334 struct etr_buf *tmc_etr_get_buffer(struct coresight_device *csdev, 1335 - enum cs_mode mode, void *data) 1335 + enum cs_mode mode, 1336 + struct coresight_path *path) 1336 1337 { 1337 - struct coresight_path *path = data; 1338 1338 struct perf_output_handle *handle = path->handle; 1339 1339 struct etr_perf_buffer *etr_perf; 1340 1340
+2 -1
drivers/hwtracing/coresight/coresight-tmc.h
··· 442 442 void tmc_etr_set_catu_ops(const struct etr_buf_operations *catu); 443 443 void tmc_etr_remove_catu_ops(void); 444 444 struct etr_buf *tmc_etr_get_buffer(struct coresight_device *csdev, 445 - enum cs_mode mode, void *data); 445 + enum cs_mode mode, 446 + struct coresight_path *path); 446 447 extern const struct attribute_group coresight_etr_group; 447 448 448 449 #endif
+3 -2
include/linux/coresight.h
··· 424 424 */ 425 425 struct coresight_ops_helper { 426 426 int (*enable)(struct coresight_device *csdev, enum cs_mode mode, 427 - void *data); 428 - int (*disable)(struct coresight_device *csdev, void *data); 427 + struct coresight_path *path); 428 + int (*disable)(struct coresight_device *csdev, 429 + struct coresight_path *path); 429 430 }; 430 431 431 432