On Sat, 2014-05-10 at 17:41 +0200, Bjørn Mork wrote:
> Split out the part of setup dealing with updating the rx_max
> and tx_max buffer sizes so that this code can be reused for
> dynamically updating the limits.
>
> Signed-off-by: Bjørn Mork <[email protected]>
> ---
> drivers/net/usb/cdc_ncm.c | 81
> +++++++++++++++++++++++++++++------------------
> 1 file changed, 50 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
> index 549dbac710ed..87a32edf7ea5 100644
> --- a/drivers/net/usb/cdc_ncm.c
> +++ b/drivers/net/usb/cdc_ncm.c
> @@ -65,6 +65,54 @@ static void cdc_ncm_tx_timeout_start(struct cdc_ncm_ctx
> *ctx);
> static enum hrtimer_restart cdc_ncm_tx_timer_cb(struct hrtimer *hr_timer);
> static struct usb_driver cdc_ncm_driver;
>
> +/* handle rx_max and tx_max changes */
> +static void cdc_ncm_update_rxtx_max(struct usbnet *dev, u32 new_rx, u32
> new_tx)
> +{
> + struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0];
> + u8 iface_no = ctx->control->cur_altsetting->desc.bInterfaceNumber;
> + u32 val, max, min;
> +
> + /* clamp new_rx to sane values */
> + min = min_t(u32, USB_CDC_NCM_NTB_MIN_IN_SIZE,
> le32_to_cpu(ctx->ncm_parm.dwNtbInMaxSize));
> + max = min_t(u32, CDC_NCM_NTB_MAX_SIZE_RX,
> le32_to_cpu(ctx->ncm_parm.dwNtbInMaxSize));
Are you sure this makes sense? min_t both times?
Regards
Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html