/** *sh_early_platform_driver_register-registerearlyplatformdriver *@epdrv:sh_early_platformdriverstructure *@buf:stringpassedfromearly_param() * *Helperfunctionforsh_early_platform_init()/sh_early_platform_init_buffer()
*/ int __init sh_early_platform_driver_register(struct sh_early_platform_driver *epdrv, char *buf)
{ char *tmp; int n;
/* Simply add the driver to the end of the global list. *Driverswillbydefaultbeputonthelistincompiled-inorder.
*/ if (!epdrv->list.next) {
INIT_LIST_HEAD(&epdrv->list);
list_add_tail(&epdrv->list, &sh_early_platform_driver_list);
}
/* If the user has specified device then make sure the driver *getsprioritized.Thedriverofthelastdevicespecifiedon *commandlinewillbeputfirstonthelist.
*/
n = strlen(epdrv->pdrv->driver.name); if (buf && !strncmp(buf, epdrv->pdrv->driver.name, n)) {
list_move(&epdrv->list, &sh_early_platform_driver_list);
/* Allow passing parameters after device name */ if (buf[n] == '\0' || buf[n] == ',')
epdrv->requested_id = -1; else {
epdrv->requested_id = simple_strtoul(&buf[n + 1],
&tmp, 10);
if (buf[n] != '.' || (tmp == &buf[n + 1])) {
epdrv->requested_id = EARLY_PLATFORM_ID_ERROR;
n = 0;
} else
n += strcspn(&buf[n + 1], ",") + 1;
}
list_for_each_entry(pd, &sh_early_platform_device_list, dev.devres_head) if (platform_match(&pd->dev, &epdrv->pdrv->driver)) if (pd->id >= id) return1;
return0;
}
/** *sh_early_platform_driver_probe_id-probedriversmatchingclass_strandid *@class_str:stringtoidentifyearlyplatformdriverclass *@id:idtomatchagainst *@nr_probe:numberofplatformdevicestosuccessfullyprobebeforeexiting
*/ staticint __init sh_early_platform_driver_probe_id(char *class_str, int id, int nr_probe)
{ struct sh_early_platform_driver *epdrv; struct platform_device *match; int match_id; int n = 0; int left = 0;
list_for_each_entry(epdrv, &sh_early_platform_driver_list, list) { /* only use drivers matching our class_str */ if (strcmp(class_str, epdrv->class_str)) continue;
if (id == -2) {
match_id = epdrv->requested_id;
left = 1;
} else {
match_id = id;
left += sh_early_platform_left(epdrv, id);
/* skip requested id */ switch (epdrv->requested_id) { case EARLY_PLATFORM_ID_ERROR: case EARLY_PLATFORM_ID_UNSET: break; default: if (epdrv->requested_id == id)
match_id = EARLY_PLATFORM_ID_UNSET;
}
}
switch (match_id) { case EARLY_PLATFORM_ID_ERROR:
pr_warn("%s: unable to parse %s parameter\n",
class_str, epdrv->pdrv->driver.name);
fallthrough; case EARLY_PLATFORM_ID_UNSET:
match = NULL; break; default:
match = sh_early_platform_match(epdrv, match_id);
}
if (match) { /* *Setupasensibleinit_nametoenable *dev_name()andotherstobeusedbeforethe *restofthedrivercoreisinitialized.
*/ if (!match->dev.init_name && slab_is_available()) { if (match->id != -1)
match->dev.init_name =
kasprintf(GFP_KERNEL, "%s.%d",
match->name,
match->id); else
match->dev.init_name =
kasprintf(GFP_KERNEL, "%s",
match->name);
if (!match->dev.init_name) return -ENOMEM;
}
if (epdrv->pdrv->probe(match))
pr_warn("%s: unable to probe %s early.\n",
class_str, match->name); else
n++;
}
if (n >= nr_probe) break;
}
if (left) return n; else return -ENODEV;
}
/** *sh_early_platform_driver_probe-probeaclassofregistereddrivers *@class_str:stringtoidentifyearlyplatformdriverclass *@nr_probe:numberofplatformdevicestosuccessfullyprobebeforeexiting *@user_only:onlyprobeuserspecifiedearlyplatformdevices * *Usedbyarchitecturecodetoproberegisteredearlyplatformdrivers *withinacertainclass.Forprobetohappenaregisteredearlyplatform *devicematchingaregisteredearlyplatformdriverisneeded.
*/ int __init sh_early_platform_driver_probe(char *class_str, int nr_probe, int user_only)
{ int k, n, i;
n = 0; for (i = -2; n < nr_probe; i++) {
k = sh_early_platform_driver_probe_id(class_str, i, nr_probe - n);
/* clean up the devres list used to chain devices */
list_for_each_entry_safe(pd, pd2, &sh_early_platform_device_list,
dev.devres_head) {
list_del(&pd->dev.devres_head);
memset(&pd->dev.devres_head, 0, sizeof(pd->dev.devres_head));
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet am 2026-09-29)
¤
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.