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

Sebastian Reichel
2017-01-08T22:41:00Z

[-- Attachment #1: Type: text/plain, Size: 1440 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]