1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/kernel.h>
4 #include <linux/stat.h>
8 static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
11 struct soundbus_dev *sdev = to_soundbus_device(dev);
12 struct platform_device *of = &sdev->ofdev;
15 if (*sdev->modalias) {
16 strlcpy(buf, sdev->modalias, sizeof(sdev->modalias) + 1);
20 length = sprintf(buf, "of:N%pOFn%c%s\n",
22 of_node_get_device_type(of->dev.of_node));
27 static DEVICE_ATTR_RO(modalias);
29 static ssize_t name_show(struct device *dev,
30 struct device_attribute *attr, char *buf)
32 struct soundbus_dev *sdev = to_soundbus_device(dev);
33 struct platform_device *of = &sdev->ofdev;
35 return sprintf(buf, "%pOFn\n", of->dev.of_node);
37 static DEVICE_ATTR_RO(name);
39 static ssize_t type_show(struct device *dev,
40 struct device_attribute *attr, char *buf)
42 struct soundbus_dev *sdev = to_soundbus_device(dev);
43 struct platform_device *of = &sdev->ofdev;
45 return sprintf(buf, "%s\n", of_node_get_device_type(of->dev.of_node));
47 static DEVICE_ATTR_RO(type);
49 struct attribute *soundbus_dev_attrs[] = {
52 &dev_attr_modalias.attr,