Re: [PATCH 7/9] serdev: Introduce new bus for serial attached devices
From: Sebastian Reichel
Date: Sun Jan 08 2017 - 17:41:59 EST
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
Attachment:
signature.asc
Description: PGP signature