[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b3a98835-8ecb-761b-2a1b-4dec0a3b6fed@zago.net>
Date: Wed, 15 Jun 2022 20:24:24 -0500
From: Frank Zago <frank@...o.net>
To: Johan Hovold <johan@...nel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org,
Bartosz Golaszewski <bgolaszewski@...libre.com>,
Wolfram Sang <wsa@...nel.org>, linux-usb@...r.kernel.org,
Lee Jones <lee.jones@...aro.org>,
Linus Walleij <linus.walleij@...aro.org>,
linux-gpio@...r.kernel.org, linux-i2c@...r.kernel.org
Subject: Re: [PATCH v5 1/3] mfd: ch341: add core driver for the WCH CH341 in
I2C/SPI/GPIO mode
Hi Johan,
On 5/23/22 10:56, Johan Hovold wrote:
>> +
>> + dev = devm_kzalloc(&iface->dev, sizeof(*dev), GFP_KERNEL);
>> + if (!dev)
>> + return -ENOMEM;
>> +
>> + dev->usb_dev = usb_get_dev(interface_to_usbdev(iface));
>
> No need to grab a reference unless you're going to hold on to it past
> disconnect().
I removed that.
>> +
>> + endpoints = iface->cur_altsetting->endpoint;
>> + if (!usb_endpoint_is_bulk_in(&endpoints[0].desc) ||
>> + !usb_endpoint_is_bulk_out(&endpoints[1].desc) ||
>> + !usb_endpoint_xfer_int(&endpoints[2].desc)) {
>> + rc = -ENODEV;
>> + goto free_dev;
>> + }
>
> Please use usb_find_common_endpoints() for the above.
Thanks. I wasn't aware on that API. It simplifies things a bit.
Regards,
Frank.
Powered by blists - more mailing lists