static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf) { struct rpmsg_device *rpdev = to_rpmsg_device(dev); ssize_t len; len = of_device_modalias(dev, buf, PAGE_SIZE); if (len != -ENODEV) return len; return sprintf(buf, RPMSG_DEVICE_MODALIAS_FMT "\n", rpdev->id.name); }
static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf) { int len; struct ulpi *ulpi = to_ulpi_dev(dev); len = of_device_modalias(dev, buf, PAGE_SIZE); if (len != -ENODEV) return len; return sprintf(buf, "ulpi:v%04xp%04x\n", ulpi->id.vendor, ulpi->id.product); }
/* modalias support enables more hands-off userspace setup: * (a) environment variable lets new-style hotplug events work once system is * fully running: "modprobe $MODALIAS" * (b) sysfs attribute lets new-style coldplug recover from hotplug events * mishandled before system is fully running: "modprobe $(cat modalias)" */ static ssize_t modalias_show(struct device *dev, struct device_attribute *a, char *buf) { struct platform_device *pdev = to_platform_device(dev); int len; len = of_device_modalias(dev, buf, PAGE_SIZE); if (len != -ENODEV) return len; len = acpi_device_modalias(dev, buf, PAGE_SIZE -1); if (len != -ENODEV) return len; len = snprintf(buf, PAGE_SIZE, "platform:%s\n", pdev->name); return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len; }