*参照元 [#g1d1fbef] #backlinks *説明 [#u947e151] -パス: [[linux-4.4.1/sound/soc/soc-core.c]] -FIXME: これは何? --説明 **引数 [#c3b89069] -struct device *dev -- --[[linux-4.4.1/device]] -int *id -- **返り値 [#nc7f07f0] -char * -- **参考 [#n44b92a7] *実装 [#u75162cc] /* * Simplify DAI link configuration by removing ".-1" from device names * and sanitizing names. */ static char *fmt_single_name(struct device *dev, int *id) { char *found, name[NAME_SIZE]; int id1, id2; if (dev_name(dev) == NULL) return NULL; - --[[linux-4.4.1/dev_name)()]] --[[linux-4.4.1/dev_name()]] strlcpy(name, dev_name(dev), NAME_SIZE); - --[[linux-4.4.1/strlcpy()]] /* are we a "%s.%d" name (platform and SPI components) */ found = strstr(name, dev->driver->name); if (found) { - --[[linux-4.4.1/strstr()]] /* get ID */ if (sscanf(&found[strlen(dev->driver->name)], ".%d", id) == 1) { /* discard ID from name if ID == -1 */ if (*id == -1) found[strlen(dev->driver->name)] = '\0'; } - --[[linux-4.4.1/sscanf()]] --[[linux-4.4.1/strlen()]] } else { /* I2C component devices are named "bus-addr" */ if (sscanf(name, "%x-%x", &id1, &id2) == 2) { char tmp[NAME_SIZE]; /* create unique ID number from I2C addr and bus */ *id = ((id1 & 0xffff) << 16) + id2; /* sanitize component name for DAI link creation */ snprintf(tmp, NAME_SIZE, "%s.%s", dev->driver->name, name); strlcpy(name, tmp, NAME_SIZE); - --[[linux-4.4.1/snprintf()]] } else *id = 0; } return kstrdup(name, GFP_KERNEL); - --[[linux-4.4.1/kstrdup()]] } *コメント [#xcfbdda8]