From: Malcolm Priestley Date: Wed, 16 Jul 2014 21:22:06 +0000 (+0100) Subject: staging: vt6656: main_usb.c Replace DEVICE_PARAM RxDescriptors0 X-Git-Tag: v3.17-rc1~123^2~527 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=2f020ebcda486855da4f462b5d52feca1d3f1f77;p=karo-tx-linux.git staging: vt6656: main_usb.c Replace DEVICE_PARAM RxDescriptors0 Replace with vnt_rx_buffers using module_param_named and MODULE_PARM_DESC Check user doe not set rx_buffer beyond the define limits of driver Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index ed56b603bb39..6e79c4c012fc 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -78,7 +78,9 @@ MODULE_DESCRIPTION(DEVICE_FULL_DRV_NAM); MODULE_PARM_DESC(N, D) #define RX_DESC_DEF0 64 -DEVICE_PARAM(RxDescriptors0, "Number of receive usb desc buffer"); +static int vnt_rx_buffers = RX_DESC_DEF0; +module_param_named(rx_buffers, vnt_rx_buffers, int, 0644); +MODULE_PARM_DESC(rx_buffers, "Number of receive usb rx buffers"); #define TX_DESC_DEF0 64 DEVICE_PARAM(TxDescriptors0, "Number of transmit usb desc buffer"); @@ -203,7 +205,13 @@ static void usb_device_reset(struct vnt_private *pDevice); static void device_set_options(struct vnt_private *priv) { priv->cbTD = TX_DESC_DEF0; - priv->cbRD = RX_DESC_DEF0; + + /* Set number of RX buffers */ + if (vnt_rx_buffers < CB_MIN_RX_DESC || vnt_rx_buffers > CB_MAX_RX_DESC) + priv->cbRD = RX_DESC_DEF0; + else + priv->cbRD = vnt_rx_buffers; + priv->byShortRetryLimit = SHORT_RETRY_DEF; priv->byLongRetryLimit = LONG_RETRY_DEF; priv->op_mode = NL80211_IFTYPE_UNSPECIFIED;