Re: [RFC PATCH 2/2] bluetooth/hci_h4: add serdev support

Andrew Lunn
2022-11-08T20:38:47Z

> +static int h4_probe(struct serdev_device *serdev)
> +{
> + struct h4_device *h4dev;
> + struct hci_uart *hu;
> + int ret;
> + u32 speed;
> +
> + h4dev = devm_kzalloc(&serdev->dev, sizeof(*h4dev), GFP_KERNEL);
> + if (!h4dev)
> + return -ENOMEM;
> +
> + hu = &h4dev->hu;
> +
> + hu->serdev = serdev;
> + ret = device_property_read_u32(&serdev->dev, "max-speed", &speed);
> + if (!ret) {
> + /* h4 does not have any baudrate handling:
> + * user oper speed from the start
> + */
> + hu->init_speed = speed;
> + hu->oper_speed = speed;
> + }
> +
> + serdev_device_set_drvdata(serdev, h4dev);
> + dev_info(&serdev->dev, "h4 device registered.\n");

It is considered bad practice to spam the logs like this. dev_dbg().

> +
> + return hci_uart_register_device(hu, &h4p);
> +}
> +
> +static void h4_remove(struct serdev_device *serdev)
> +{
> + struct h4_device *h4dev = serdev_device_get_drvdata(serdev);
> +
> + dev_info(&serdev->dev, "h4 device unregistered.\n");

dev_dbg().

Andrew