Re: [PATCH v3 1/4] Simplify usbnet_cdc_update_filter

From: Bjørn Mork <bjorn@mork.no>
Date: 2018-07-02 17:13:13
Also in: linux-usb

Oliver Neukum [off-list ref] writes:
On So, 2018-07-01 at 11:05 +0200, Miguel Rodríguez Pérez         wrote:
quoted
Remove some unneded varibles to make the code easier to read
and, replace the generic usb_control_msg function for the
more specific usbnet_write_cmd.

Signed-off-by: Miguel Rodríguez Pérez <redacted>
No,

sorry, but this is not good. The reason is a bit subtle.
Drivers need to reset the filters when handling post_reset()
[ and reset_resume() ] usbnet_write_cmd() falls back to
kmemdup() with GFP_KERNEL. Usbnet is a framework with class
drivers and some of the devices we drive have a storage
interface. Thence we are on the block error handling path here.
Right.  I knew there had to be some reason this was left out when the
rest of these were converted.  But I don't think the reason is
valid... usbnet_write_cmd() will never call kmemdup when data is NULL.

There is of course also little advantage in using usbnet_write_cmd when
we don't need to allocate a buffer.  But I'd still prefer to see it for
consistency, power management and debug logging.

Or if it is left as-is: Maybe add a comment so that I don't ask the same
stupid questions in 3 weeks time? :-)  My memory is los^Husy...
The simplest solution is to leave out this patch in the sequence.
As Miguel noted: That won't work. The switch from dev->data->control to
dev->intf is necessary to make this function reusable by other
minidrivers.




Bjørn
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help