Thread (40 messages) 40 messages, 8 authors, 2017-01-14

Re: [PATCH 7/9] serdev: Introduce new bus for serial attached devices

From: Sebastian Reichel <sre@kernel.org>
Date: 2017-01-08 22:41:55
Also in: linux-serial, lkml

Hi,

On Fri, Jan 06, 2017 at 10:26:33AM -0600, Rob Herring wrote:
[...]

+static int serdev_device_match(struct device *dev, struct device_driver *drv)
+{
+	return of_driver_match_device(dev, drv);
+}
Maybe add a TODO note here for ACPI/platform support?
[...]

+int serdev_device_open(struct serdev_device *serdev)
+{
+	struct serdev_controller *ctrl = serdev->ctrl;
+
+	if (!ctrl || !ctrl->ops->open)
+		return 0;
+
+	return serdev->ctrl->ops->open(ctrl);
+}
+EXPORT_SYMBOL_GPL(serdev_device_open);
I would expect an error code if a serdev has no controller / open
method assigned?
[...]

+static int of_serdev_register_devices(struct serdev_controller *ctrl)
+{
+	struct device_node *node;
+	struct serdev_device *serdev = NULL;
+	int err;
+	bool found = false;
+
+	for_each_available_child_of_node(ctrl->dev.of_node, node) {
+		if (!of_get_property(node, "compatible", NULL))
+			continue;
+
+		dev_dbg(&ctrl->dev, "adding child %s\n", node->full_name);
+
+		serdev = serdev_device_alloc(ctrl);
+		if (!serdev)
+			continue;
+
+		serdev->dev.of_node = node;
+
+		err = serdev_device_add(serdev);
+		if (err) {
+			dev_err(&serdev->dev,
+				"failure adding device. status %d\n", err);
+			serdev_device_put(serdev);
missing continue here?
+		}
+		found = true;
+	}
+	if (!found)
+		return -ENODEV;
+
+	return 0;
+}
-- Sebastian

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help