Re: [PATCH v6 2/3] greybus: Add BeaglePlay Linux Driver

From: Krzysztof Kozlowski
Date: Tue Oct 03 2023 - 04:25:16 EST


On 02/10/2023 20:24, Ayush Singh wrote:
> Add the Greybus host driver for BeaglePlay board by BeagleBoard.org.
>
> The current greybus setup involves running SVC in a user-space
> application (GBridge) and using netlink to communicate with kernel
> space. GBridge itself uses wpanusb kernel driver, so the greybus messages
> travel from kernel space (gb_netlink) to user-space (GBridge) and then
> back to kernel space (wpanusb) before reaching CC1352.
>
> This driver directly communicates with CC1352 (running SVC Zephyr
> application). Thus, it simplifies the complete greybus setup eliminating
> user-space GBridge.
>

...

Thank you for your patch. There is something to discuss/improve.

> +
> +static int gb_serdev_init(struct gb_beagleplay *bg)
> +{
> + u32 speed = 115200;
> + int ret;
> +
> + serdev_device_set_drvdata(bg->sd, bg);
> + serdev_device_set_client_ops(bg->sd, &gb_beagleplay_ops);
> + ret = serdev_device_open(bg->sd);
> + if (ret)
> + return dev_err_probe(&bg->sd->dev, ret, "Unable to open serial device");
> +
> + speed = serdev_device_set_baudrate(bg->sd, speed);

Unused value speed. Probably this results in warnings. Plus it is a
confusing code. Check the return value if it is relevant. If it can be
ignored, skip assignment and drop "speed" variable.

Rest looks okay to me after glance (I did not perform full review).


> + serdev_device_set_flow_control(bg->sd, false);
> +
> + return 0;
> +}
> +
> +static int gb_beagleplay_probe(struct serdev_device *serdev)
> +{
> + int ret = 0;
> + struct gb_beagleplay *bg;
> +
> + bg = devm_kmalloc(&serdev->dev, sizeof(*bg), GFP_KERNEL);
> + if (!bg)
> + return -ENOMEM;
> +
Best regards,
Krzysztof