Re: [PATCH v1 1/9] mfd: Add core driver for Nuvoton NCT6694

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 24.10.2024 17:20:57, Marc Kleine-Budde wrote:

[...]

> > +	nct6694->cmd_buffer = devm_kcalloc(dev, CMD_PACKET_SZ,
> > +					   sizeof(unsigned char), GFP_KERNEL);
> > +	if (!nct6694->cmd_buffer)
> > +		return -ENOMEM;
> > +	nct6694->rx_buffer = devm_kcalloc(dev, MAX_PACKET_SZ,
> > +					  sizeof(unsigned char), GFP_KERNEL);
> > +	if (!nct6694->rx_buffer)
> > +		return -ENOMEM;
> > +	nct6694->tx_buffer = devm_kcalloc(dev, MAX_PACKET_SZ,
> > +					  sizeof(unsigned char), GFP_KERNEL);
> > +	if (!nct6694->tx_buffer)
> > +		return -ENOMEM;
> > +	nct6694->int_buffer = devm_kcalloc(dev, MAX_PACKET_SZ,
> > +					   sizeof(unsigned char), GFP_KERNEL);
> > +	if (!nct6694->int_buffer)
> > +		return -ENOMEM;
> > +
> > +	nct6694->int_in_urb = usb_alloc_urb(0, GFP_KERNEL);
> > +	if (!nct6694->int_in_urb) {
> > +		dev_err(&udev->dev, "Failed to allocate INT-in urb!\n");
> > +		return -ENOMEM;
> > +	}
> > +
> > +	/* Bulk pipe maximum packet for each transaction */
> > +	bulk_pipe = usb_sndbulkpipe(udev, BULK_OUT_ENDPOINT);
> > +	nct6694->maxp = usb_maxpacket(udev, bulk_pipe);
> > +
> > +	mutex_init(&nct6694->access_lock);
> > +	nct6694->udev = udev;
> > +	nct6694->timeout = URB_TIMEOUT;	/* Wait until urb complete */
> > +
> > +	INIT_LIST_HEAD(&nct6694->handler_list);
> > +	spin_lock_init(&nct6694->lock);
> > +
> > +	usb_fill_int_urb(nct6694->int_in_urb, udev, pipe,
> > +			 nct6694->int_buffer, maxp, usb_int_callback,
> > +			 nct6694, int_endpoint->bInterval);
> > +	ret = usb_submit_urb(nct6694->int_in_urb, GFP_KERNEL);
> > +	if (ret)
> > +		goto err_urb;
> > +
> > +	dev_set_drvdata(&udev->dev, nct6694);
> > +	usb_set_intfdata(iface, nct6694);
> > +
> > +	ret = mfd_add_hotplug_devices(&udev->dev, nct6694_dev,
> > +				      ARRAY_SIZE(nct6694_dev));
> > +	if (ret) {
> > +		dev_err(&udev->dev, "Failed to add mfd's child device\n");
> > +		goto err_mfd;
> > +	}
> > +
> > +	nct6694->async_workqueue = alloc_ordered_workqueue("asyn_workqueue", 0);
> 
> Where is the async_workqueue used?

Sorry - it's used in the driver, which live in separate directories -
you can ignore this comment.

But then the question comes up, it looks racy to _first_ add the devices
and _then_ the workqueue.

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


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux