/* *Recursivelyexploreeachportfoundonthiselement.
*/ for (i = 0; i < csdev->pdata->nr_outconns; i++) { struct coresight_device *child_dev;
child_dev = csdev->pdata->out_conns[i]->dest_dev; if (child_dev)
sink = coresight_find_activated_sysfs_sink(child_dev); if (sink) return sink;
}
return NULL;
}
/** coresight_validate_source - make sure a source has the right credentials to *beusedviasysfs. *@csdev:thedevicestructureforasource. *@function:thefunctionthiswascalledfrom. * *Assumesthecoresight_mutexisheld.
*/ staticint coresight_validate_source_sysfs(struct coresight_device *csdev, constchar *function)
{
u32 type, subtype;
type = csdev->type;
subtype = csdev->subtype.source_subtype;
if (type != CORESIGHT_DEV_TYPE_SOURCE) {
dev_err(&csdev->dev, "wrong device type in %s\n", function); return -EINVAL;
}
ret = coresight_validate_source_sysfs(csdev, __func__); if (ret) goto out;
if (!coresight_disable_source_sysfs(csdev, NULL)) goto out;
switch (csdev->subtype.source_subtype) { case CORESIGHT_DEV_SUBTYPE_SOURCE_PROC:
cpu = source_ops(csdev)->cpu_id(csdev);
path = per_cpu(tracer_path, cpu);
per_cpu(tracer_path, cpu) = NULL; break; case CORESIGHT_DEV_SUBTYPE_SOURCE_SOFTWARE: case CORESIGHT_DEV_SUBTYPE_SOURCE_TPDM: case CORESIGHT_DEV_SUBTYPE_SOURCE_OTHERS:
hash = hashlen_hash(hashlen_string(NULL, dev_name(&csdev->dev))); /* Find the path by the hash. */
path = idr_find(&path_idr, hash); if (path == NULL) {
pr_err("Path is not found for %s\n", dev_name(&csdev->dev)); goto out;
}
idr_remove(&path_idr, hash); break; default: /* We can't be here */ break;
}
/* *CreateconnectionsgroupforCoreSightdevices. *Thisgroupwillthenbeusedtocollatethesysfslinksbetween *devices.
*/ int coresight_create_conns_sysfs_group(struct coresight_device *csdev)
{ int ret = 0;
if (!csdev) return -EINVAL;
ret = sysfs_create_group(&csdev->dev.kobj, &coresight_conns_group); if (ret) return ret;
csdev->has_conns_grp = true; return ret;
}
void coresight_remove_conns_sysfs_group(struct coresight_device *csdev)
{ if (!csdev) return;
if (csdev->has_conns_grp) {
sysfs_remove_group(&csdev->dev.kobj, &coresight_conns_group);
csdev->has_conns_grp = false;
}
}
int coresight_add_sysfs_link(struct coresight_sysfs_link *info)
{ int ret = 0;
if (!info) return -EINVAL; if (!info->orig || !info->target ||
!info->orig_name || !info->target_name) return -EINVAL; if (!info->orig->has_conns_grp || !info->target->has_conns_grp) return -EINVAL;
/* first link orig->target */
ret = sysfs_add_link_to_group(&info->orig->dev.kobj,
coresight_conns_group.name,
&info->target->dev.kobj,
info->orig_name); if (ret) return ret;
/* second link target->orig */
ret = sysfs_add_link_to_group(&info->target->dev.kobj,
coresight_conns_group.name,
&info->orig->dev.kobj,
info->target_name);
/* error in second link - remove first - otherwise inc counts */ if (ret) {
sysfs_remove_link_from_group(&info->orig->dev.kobj,
coresight_conns_group.name,
info->orig_name);
} else {
info->orig->nr_links++;
info->target->nr_links++;
}
/* Helper devices aren't shown in sysfs */ if (conn->dest_port == -1 && conn->src_port == -1) return0;
do {
outs = devm_kasprintf(&orig->dev, GFP_KERNEL, "out:%d", conn->src_port); if (!outs) break;
ins = devm_kasprintf(&target->dev, GFP_KERNEL, "in:%d", conn->dest_port); if (!ins) break;
link = devm_kzalloc(&orig->dev, sizeof(struct coresight_sysfs_link),
GFP_KERNEL); if (!link) break;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.