Re: [PATCH v8 1/7] mfd: Add core driver for Nuvoton NCT6694

From: Marc Kleine-Budde
Date: Fri Feb 28 2025 - 03:53:16 EST


On 25.02.2025 16:16:38, Ming Yu wrote:

[...]

> +static int nct6694_usb_probe(struct usb_interface *iface,
> + const struct usb_device_id *id)
> +{
> + struct usb_device *udev = interface_to_usbdev(iface);
> + struct usb_endpoint_descriptor *int_endpoint;
> + struct usb_host_interface *interface;
> + struct device *dev = &iface->dev;
> + struct nct6694 *nct6694;
> + int pipe, maxp;
> + int ret;
> +
> + nct6694 = devm_kzalloc(dev, sizeof(*nct6694), GFP_KERNEL);
> + if (!nct6694)
> + return -ENOMEM;
> +
> + pipe = usb_rcvintpipe(udev, NCT6694_INT_IN_EP);
> + maxp = usb_maxpacket(udev, pipe);
> +
> + nct6694->usb_msg = devm_kzalloc(dev, sizeof(union nct6694_usb_msg), GFP_KERNEL);
> + if (!nct6694->usb_msg)
> + return -ENOMEM;
> +
> + nct6694->int_buffer = devm_kzalloc(dev, maxp, GFP_KERNEL);
> + if (!nct6694->int_buffer)
> + return -ENOMEM;
> +
> + nct6694->int_in_urb = usb_alloc_urb(0, GFP_KERNEL);
> + if (!nct6694->int_in_urb)
> + return -ENOMEM;
> +
> + nct6694->domain = irq_domain_add_simple(NULL, NCT6694_NR_IRQS, 0,
> + &nct6694_irq_domain_ops,
> + nct6694);
> + if (!nct6694->domain) {
> + ret = -ENODEV;
> + goto err_urb;
> + }
> +
> + nct6694->dev = dev;
> + nct6694->udev = udev;
> + nct6694->timeout = NCT6694_URB_TIMEOUT; /* Wait until URB completes */

Why do you need this variable? You can directly use NCT6694_URB_TIMEOUT
in the usb_bulk_msg() and friends calls.

regards,
Marc

--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |

Attachment: signature.asc
Description: PGP signature