Bluetooth: btmrvl: remove memory allocation failure message
PATCH 1/4 Bluetooth: btmrvl: remove memory allocation failure message
These changes resolve below checkpatch warning
WARNING: Possible unnecessary 'out of memory' message
--- drivers/bluetooth/btmrvl_main.c | 8 ++------ drivers/bluetooth/btmrvl_sdio.c | 5 ++--- 2 files changed, 4 insertions(+), 9 deletions(-)
drivers/bluetooth/btmrvl_main.c +2 -6
@@ -712,16 +712,12 @@ struct btmrvl_private *btmrvl_add_card(void *card)struct btmrvl_private *priv; priv =kzalloc (sizeof (*priv),GFP_KERNEL ); -if (!priv) { -BT_ERR ("Can not allocate priv" ); +if (!priv) goto err_priv; - } priv->adapter =kzalloc (sizeof (*priv->adapter),GFP_KERNEL ); -if (!priv->adapter) { -BT_ERR ("Allocate buffer for btmrvl_adapter failed!" ); +if (!priv->adapter) goto err_adapter; - }btmrvl_init_adapter (priv);
drivers/bluetooth/btmrvl_sdio.c +2 -3
@@ -1382,10 +1382,9 @@ done:return ; fw_dump_data =vzalloc (fw_dump_len+1 ); -if (!fw_dump_data) { -BT_ERR ("Vzalloc fw_dump_data fail!" ); +if (!fw_dump_data)return ; - } + fw_dump_ptr = fw_dump_data;/* Dump all the memory data into single file, a userspace script will
Signature · 1 line
1.8.1.4
PATCH 2/4 Bluetooth: btmrvl: add prints debug control support
From: Zhaoyang Liu <[email protected]>
This patch adds support for debugging print control in marvell bluetooth driver. The debug level can be controlled by setting module loading parameter debug_mask.
Example:
insmod btmrvl.ko debug_mask=0x37
--- drivers/bluetooth/btmrvl_drv.h | 35 ++++++++++++++++++++++++++++++++++- drivers/bluetooth/btmrvl_main.c | 18 ++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-)
drivers/bluetooth/btmrvl_drv.h +34 -1
@@ -79,6 +79,7 @@ struct btmrvl_device {struct btmrvl_adapter {void *hw_regs_buf;u8 *hw_regs; +unsigned int debug_mask;u32 int_count;struct sk_buff_head tx_queue;u8 psmode;
@@ -155,8 +156,40 @@ struct btmrvl_event {u8 data[4 ]; } __packed; -/* Prototype of global function */ +/* marvell bluetooth driver debug level */ +enum BTMRVL_DEBUG_LEVEL { +BTMRVL_DBG_MSG =0x00000001 , +BTMRVL_DBG_FATAL =0x00000002 , +BTMRVL_DBG_ERROR =0x00000004 , +BTMRVL_DBG_DATA =0x00000008 , +BTMRVL_DBG_CMD =0x00000010 , +BTMRVL_DBG_EVENT =0x00000020 , +BTMRVL_DBG_INTR =0x00000040 , + +BTMRVL_DBG_DAT_D =0x00010000 , +BTMRVL_DBG_CMD_D =0x00020000 , + +BTMRVL_DBG_ENTRY =0x10000000 , +BTMRVL_DBG_WARN =0x20000000 , +BTMRVL_DBG_INFO =0x40000000 , + +BTMRVL_DBG_ANY =0xffffffff +}; +#define BTMRVL_DBG_DEFAULT_MASK (BTMRVL_DBG_MSG | \ + BTMRVL_DBG_FATAL | \ + BTMRVL_DBG_ERROR) + +int btmrvl_log_allowed (struct btmrvl_adapter *adapter, +enum BTMRVL_DEBUG_LEVEL level); + +#define btmrvl_dbg(adapter, dbg_mask, fmt, args...) \ +do { \ + if (btmrvl_log_allowed(adapter, BTMRVL_DBG_##dbg_mask)) \ + pr_info("btmrvl: " fmt "\n", ##args); \ +} while (0) + +/* Prototype of global function */ int btmrvl_register_hdev (struct btmrvl_private *priv);struct btmrvl_private *btmrvl_add_card (void *card);int btmrvl_remove_card (struct btmrvl_private *priv);
drivers/bluetooth/btmrvl_main.c +18 -0
@@ -29,6 +29,23 @@#define VERSION "1.0" +static unsigned int debug_mask =BTMRVL_DBG_DEFAULT_MASK ; +module_param (debug_mask, uint,0 ); +MODULE_PARM_DESC (debug_mask,"bitmap for debug flags" ); + +int btmrvl_log_allowed (struct btmrvl_adapter *adapter, +enum BTMRVL_DEBUG_LEVEL level) +{ +if (!adapter && (BTMRVL_DBG_DEFAULT_MASK & level)) +return true; + +if (adapter->debug_mask & level) +return true; + +return false; +} +EXPORT_SYMBOL_GPL (btmrvl_log_allowed); +/* * This function is called by interface specific interrupt handler. * It updates Power Save & Host Sleep states, and wakes up the main
@@ -402,6 +419,7 @@ static void btmrvl_init_adapter(struct btmrvl_private *priv)skb_queue_head_init (&priv->adapter->tx_queue); priv->adapter->ps_state =PS_AWAKE ; + priv->adapter->debug_mask = debug_mask; buf_size =ALIGN_SZ (SDIO_BLOCK_SIZE ,BTSDIO_DMA_ALIGN ); priv->adapter->hw_regs_buf =kzalloc (buf_size,GFP_KERNEL );
Signature · 1 line
1.8.1.4
Marcel Holtmann
maintainerRe: [PATCH 2/4] Bluetooth: btmrvl: add prints debug control support
Hi Amitkumar,
Quoted 74 lines
This patch adds support for debugging print control in marvell bluetooth driver. The debug level can be controlled by setting module loading parameter
debug_mask.Example:
insmod btmrvl.ko debug_mask=0x37Signed-off-by Zhaoyang Liu <[email protected]>Signed-off-by Cathy Luo <[email protected]>Signed-off-by Amitkumar Karwar <[email protected]>---
drivers/bluetooth/btmrvl_drv.h| 35 ++++++++++++++++++++++++++++++++++-drivers/bluetooth/btmrvl_main.c| 18 ++++++++++++++++++2 files changed, 52 insertions(+), 1 deletion(-)drivers/bluetooth/btmrvl_drv.h +34
-1@@ -79,6 +79,7 @@ struct btmrvl_device {struct btmrvl_adapter {void *hw_regs_buf;u8 *hw_regs; +unsigned int debug_mask;u32 int_count;struct sk_buff_head tx_queue;u8 psmode;@@ -155,8 +156,40 @@ struct btmrvl_event {u8 data[4 ]; } __packed; -/* Prototype of global function */ +/* marvell bluetooth driver debug level */ +enum BTMRVL_DEBUG_LEVEL { +BTMRVL_DBG_MSG =0x00000001 , +BTMRVL_DBG_FATAL =0x00000002 , +BTMRVL_DBG_ERROR =0x00000004 , +BTMRVL_DBG_DATA =0x00000008 , +BTMRVL_DBG_CMD =0x00000010 , +BTMRVL_DBG_EVENT =0x00000020 , +BTMRVL_DBG_INTR =0x00000040 , + +BTMRVL_DBG_DAT_D =0x00010000 , +BTMRVL_DBG_CMD_D =0x00020000 , + +BTMRVL_DBG_ENTRY =0x10000000 , +BTMRVL_DBG_WARN =0x20000000 , +BTMRVL_DBG_INFO =0x40000000 , + +BTMRVL_DBG_ANY =0xffffffff +}; +#define BTMRVL_DBG_DEFAULT_MASK (BTMRVL_DBG_MSG | \ + BTMRVL_DBG_FATAL | \ + BTMRVL_DBG_ERROR) + +int btmrvl_log_allowed (struct btmrvl_adapter *adapter, +enum BTMRVL_DEBUG_LEVEL level); + +#define btmrvl_dbg(adapter, dbg_mask, fmt, args...) \ +do { \ + if (btmrvl_log_allowed(adapter, BTMRVL_DBG_##dbg_mask)) \ + pr_info("btmrvl: " fmt "\n", ##args); \ +} while (0) + +/* Prototype of global function */ int btmrvl_register_hdev (struct btmrvl_private *priv);struct btmrvl_private *btmrvl_add_card (void *card);int btmrvl_remove_card (struct btmrvl_private *priv);drivers/bluetooth/btmrvl_main.c +0
-0
drivers/bluetooth/btmrvl_main.c line 34
Quoted 6 lines
drivers/bluetooth/btmrvl_main.c +3
-0@@ -29,6 +29,23 @@#define VERSION "1.0" +static unsigned int debug_mask =BTMRVL_DBG_DEFAULT_MASK ; +module_param (debug_mask, uint,0 ); +MODULE_PARM_DESC (debug_mask,"bitmap for debug flags" );
I see no reason for this being a module parameter. I think you really want to have that via debugfs for reach adapter.
Regards
Marcel
RE: [PATCH 2/4] Bluetooth: btmrvl: add prints debug control support
Hi Marcel,
Quoted 85 lines
From: Marcel Holtmann [mailto:[email protected]]
Sent: Thursday, October 15, 2015 4:32 AM
To: Amitkumar Karwar
Cc: [email protected]; Cathy Luo; Zhaoyang Liu
Subject: Re: [PATCH 2/4] Bluetooth: btmrvl: add prints debug control support
=20
Hi Amitkumar,
=20Quoted 76 lines
This patch adds support for debugging print control in marvell bluetooth driver. The debug level can be controlled by setting module loading parameter
debug_mask.Example:
insmod btmrvl.ko debug_mask=3D0x37Signed-off-by Zhaoyang Liu <[email protected]>Signed-off-by Cathy Luo <[email protected]>Signed-off-by Amitkumar Karwar <[email protected]>---
drivers/bluetooth/btmrvl_drv.h| 35
++++++++++++++++++++++++++++++++++-drivers/bluetooth/btmrvl_main.c| 18 ++++++++++++++++++2 files changed, 52 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/bluetooth/btmrvl_drv.hindex 27a9aac..1119d09 100644drivers/bluetooth/btmrvl_drv.h +33
-1@@ -79,6 +79,7 @@ struct btmrvl_device { struct btmrvl_adapter {void *hw_regs_buf;u8 *hw_regs; +unsigned int debug_mask;u32 int_count;struct sk_buff_head tx_queue;u8 psmode;@@ -155,8 +156,40 @@ struct btmrvl_event {u8 data[4 ]; } __packed; -/* Prototype of global function */ +/* marvell bluetooth driver debug level */ enum BTMRVL_DEBUG_LEVEL { + BTMRVL_DBG_MSG =3D 0x00000001, + BTMRVL_DBG_FATAL =3D 0x00000002, + BTMRVL_DBG_ERROR =3D 0x00000004, + BTMRVL_DBG_DATA =3D 0x00000008, + BTMRVL_DBG_CMD =3D 0x00000010, + BTMRVL_DBG_EVENT =3D 0x00000020, + BTMRVL_DBG_INTR =3D 0x00000040, + + BTMRVL_DBG_DAT_D =3D 0x00010000, + BTMRVL_DBG_CMD_D =3D 0x00020000, + + BTMRVL_DBG_ENTRY =3D 0x10000000, + BTMRVL_DBG_WARN =3D 0x20000000, + BTMRVL_DBG_INFO =3D 0x40000000, + + BTMRVL_DBG_ANY =3D 0xffffffff +}; +#define BTMRVL_DBG_DEFAULT_MASK (BTMRVL_DBG_MSG | \ + BTMRVL_DBG_FATAL | \ + BTMRVL_DBG_ERROR) + +int btmrvl_log_allowed (struct btmrvl_adapter *adapter, +enum BTMRVL_DEBUG_LEVEL level); + +#define btmrvl_dbg(adapter, dbg_mask, fmt, args...) \ +do { \ + if (btmrvl_log_allowed(adapter, BTMRVL_DBG_##dbg_mask)) \ + pr_info("btmrvl: " fmt "\n", ##args); \ +} while (0) + +/* Prototype of global function */ int
btmrvl_register_hdev(struct btmrvl_private *priv); structbtmrvl_private*btmrvl_add_card(void *card); intbtmrvl_remove_card(struct btmrvl_private *priv); diff --gita/drivers/bluetooth/btmrvl_main.cb/drivers/bluetooth/btmrvl_main.cindex 61d2f39..8e53609 100644drivers/bluetooth/btmrvl_main.c +0
-0@@ -29,6 +29,23 @@#define VERSION "1.0"
Quoted 7 lines
drivers/bluetooth/btmrvl_main.c line 34
Quoted 3 lines
drivers/bluetooth/btmrvl_main.c +3
-0+static unsigned int debug_mask =3D BTMRVL_DBG_DEFAULT_MASK; +module_param (debug_mask, uint,0 );MODULE_PARM_DESC (debug_mask, +"bitmap for debug flags" );=20
I see no reason for this being a module parameter. I think you really want to have that via debugfs for reach adapter.
=20
Agreed. I will remove this.
Regards,
Amitkumar
PATCH 3/4 Bluetooth: btmrvl: add debug mask debugfs parameter
In reply to Amitkumar KarwarFrom: Zhaoyang Liu <[email protected]>
This patch adds support for debug mask read/write operations via debugfs. It is useful during debugging driver logs.
Examples:
Read current debug mask:
cat /sys/kernel/debug/bluetooth/hci0/config/debug_mask
Update debug mask:
echo 0xff > /sys/kernel/debug/bluetooth/hci0/config/debug_mask
--- drivers/bluetooth/btmrvl_debugfs.c | 51 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
drivers/bluetooth/btmrvl_debugfs.c +51 -0
@@ -196,6 +196,55 @@ static const struct file_operations btmrvl_fwdump_fops = { .llseek = default_llseek, }; +/* Proc debug_mask file read handler. +* This function is called when the 'debug_mask' file is opened for reading +* This function can be used read driver debugging mask value. +*/ +static ssize_t btmrvl_debug_mask_read (struct file *file,char __user *ubuf, +size_t count,loff_t *ppos) +{ +struct btmrvl_private *priv = file->private_data; +char buf[32 ]; +int ret; + + ret =snprintf (buf,sizeof (buf) -1 ,"debug mask=0x%08x\n" , + priv->adapter->debug_mask); + +return simple_read_from_buffer (ubuf, count, ppos, buf, ret); +} + +/* Proc debug_mask file read handler. +* This function is called when the 'debug_mask' file is opened for reading +* This function can be used read driver debugging mask value. +*/ +static ssize_t btmrvl_debug_mask_write (struct file *file, +const char __user *ubuf, +size_t count,loff_t *ppos) +{ +struct btmrvl_private *priv = file->private_data; +char buf[32 ]; +unsigned long dbg_mask; + +memset (buf,0 ,sizeof (buf)); + +if (copy_from_user (&buf, ubuf,min_t (size_t,sizeof (buf) -1 , count))) +return -EFAULT ; + +if (kstrtol (buf,0 , &dbg_mask)) +return -EINVAL ; + + priv->adapter->debug_mask = dbg_mask; + +return count; +} + +static const struct file_operations btmrvl_debug_mask_fops = { + .read = btmrvl_debug_mask_read, + .write = btmrvl_debug_mask_write, + .open = simple_open, + .llseek = default_llseek, +}; +void btmrvl_debugfs_init (struct hci_dev *hdev) {struct btmrvl_private *priv =hci_get_drvdata (hdev);
@@ -228,6 +277,8 @@ void btmrvl_debugfs_init(struct hci_dev *hdev) priv, &btmrvl_hscfgcmd_fops);debugfs_create_file ("fw_dump" ,0200 , dbg->config_dir, priv, &btmrvl_fwdump_fops); +debugfs_create_file ("debug_mask" ,0644 , dbg->config_dir, + priv, &btmrvl_debug_mask_fops); dbg->status_dir =debugfs_create_dir ("status" , hdev->debugfs); debugfs_create_u8("curpsmode", 0444, dbg->status_dir,
Signature · 1 line
1.8.1.4
Marcel Holtmann
maintainerRe: [PATCH 3/4] Bluetooth: btmrvl: add debug mask debugfs parameter
Hi Amitkumar,
Quoted 29 lines
This patch adds support for debug mask read/write operations via debugfs. It is useful during debugging driver logs.
Examples:
Read current debug mask:
cat/sys/kernel/debug/bluetooth/hci0/config/debug_maskUpdate debug mask:
echo0xff>/sys/kernel/debug/bluetooth/hci0/config/debug_maskSigned-off-by Zhaoyang Liu <[email protected]>Signed-off-by Cathy Luo <[email protected]>Signed-off-by Amitkumar Karwar <[email protected]>---
drivers/bluetooth/btmrvl_debugfs.c| 51 ++++++++++++++++++++++++++++++++++++++1 file changed, 51 insertions(+)drivers/bluetooth/btmrvl_debugfs.c +3
-0@@ -196,6 +196,55 @@ static const struct file_operations btmrvl_fwdump_fops = { .llseek = default_llseek, }; +/* Proc debug_mask file read handler. +* This function is called when the 'debug_mask' file is opened for reading +* This function can be used read driver debugging mask value.
drivers/bluetooth/btmrvl_debugfs.c static const struct file_operations btmrvl_fwdump_fops = { · line 211
Quoted 10 lines
drivers/bluetooth/btmrvl_debugfs.c +10
-0+*/ +static ssize_t btmrvl_debug_mask_read (struct file *file,char __user *ubuf, +size_t count,loff_t *ppos) +{ +struct btmrvl_private *priv = file->private_data; +char buf[32 ]; +int ret; + + ret =snprintf (buf,sizeof (buf) -1 ,"debug mask=0x%08x\n" , + priv->adapter->debug_mask);
the file is already called debug mask, no need to prefix the file content with some key=val thing. Just return the value.
Regards
Marcel
RE: [PATCH 3/4] Bluetooth: btmrvl: add debug mask debugfs parameter
Hi Marcel,
Quoted 45 lines
From: Marcel Holtmann [mailto:[email protected]]
Sent: Thursday, October 15, 2015 4:34 AM
To: Amitkumar Karwar
Cc: [email protected]; Cathy Luo; Zhaoyang Liu
Subject: Re: [PATCH 3/4] Bluetooth: btmrvl: add debug mask debugfs parameter
=20
Hi Amitkumar,
=20drivers/bluetooth/btmrvl_debugfs.c static const struct file_operations
Quoted 25 lines
This patch adds support for debug mask read/write operations via debugfs. It is useful during debugging driver logs.
Examples:
Read current debug mask:
cat/sys/kernel/debug/bluetooth/hci0/config/debug_maskUpdate debug mask:
echo0xff>/sys/kernel/debug/bluetooth/hci0/config/debug_maskSigned-off-by Zhaoyang Liu <[email protected]>Signed-off-by Cathy Luo <[email protected]>Signed-off-by Amitkumar Karwar <[email protected]>---
drivers/bluetooth/btmrvl_debugfs.c| 51
++++++++++++++++++++++++++++++++++++++1 file changed, 51 insertions(+)drivers/bluetooth/btmrvl_debugfs.c +0
-0@@ -196,6 +196,55 @@ static const struct file_operations
btmrvl_fwdump_fops=3D {drivers/bluetooth/btmrvl_debugfs.c static const struct file_operations btmrvl_fwdump_fops = {
Quoted 9 lines
drivers/bluetooth/btmrvl_debugfs.c +6
-0.llseek =3D default_llseek, }; +/* Proc debug_mask file read handler. +* This function is called when the 'debug_mask' file is opened for +reading +* This function can be used read driver debugging mask value. +*/ +static ssize_t btmrvl_debug_mask_read(struct file *file, char __user*ubuf,
Quoted 11 lines
drivers/bluetooth/btmrvl_debugfs.c static const struct file_operations btmrvl_fwdump_fops = { · line 211
Quoted 7 lines
drivers/bluetooth/btmrvl_debugfs.c +7
-0+ size_t count, loff_t *ppos) { + struct btmrvl_private *priv =3D file->private_data; +char buf[32 ]; +int ret; + + ret =3D snprintf(buf, sizeof(buf) - 1, "debug mask=3D0x%08x\n", + priv->adapter->debug_mask);=20
the file is already called debug mask, no need to prefix the file content with some key=3Dval thing. Just return the value. =20
Sure. We will remove redundant string "debug_mask=3D".
Regards,
Amitkumar
PATCH 4/4 Bluetooth: btmrvl: change debug prints to btmrvl_dbg
In reply to Amitkumar KarwarFrom: Zhaoyang Liu <[email protected]>
This patch changes all debug print from BT_INFO/BT_DBG/BT_ERR to marvell bluetooth driver specific debug functions.
--- drivers/bluetooth/btmrvl_debugfs.c | 3 +- drivers/bluetooth/btmrvl_main.c | 145 ++++++++++------- drivers/bluetooth/btmrvl_sdio.c | 311 ++++++++++++++++++++++--------------- 3 files changed, 275 insertions(+), 184 deletions(-)
drivers/bluetooth/btmrvl_debugfs.c +2 -1
@@ -257,7 +257,8 @@ void btmrvl_debugfs_init(struct hci_dev *hdev) priv->debugfs_data = dbg;if (!dbg) { -BT_ERR ("Can not allocate memory for btmrvl_debugfs_data." ); +btmrvl_dbg (priv->adapter,ERROR , +"Can not allocate memory for btmrvl_debugfs_data." );return ; }
drivers/bluetooth/btmrvl_main.c +86 -59
359 lines not on this page · raw message
drivers/bluetooth/btmrvl_sdio.c +187 -124
820 lines not on this page · raw message
Signature · 1 line
1.8.1.4
Marcel Holtmann
maintainerRe: [PATCH 4/4] Bluetooth: btmrvl: change debug prints to btmrvl_dbg
Hi Amitkumar,
Quoted 2 lines
This patch changes all debug print from BT_INFO/BT_DBG/BT_ERR to marvell bluetooth driver specific debug functions.
so BT_INFO and BT_ERR are not debug prints. They are genuine valid information that should be printed when something goes wrong or is informational.
Quoted 15 lines
Signed-off-by Zhaoyang Liu <[email protected]>Signed-off-by Cathy Luo <[email protected]>Signed-off-by Amitkumar Karwar <[email protected]>---
drivers/bluetooth/btmrvl_debugfs.c | 3 +- drivers/bluetooth/btmrvl_main.c | 145 ++++++++++------- drivers/bluetooth/btmrvl_sdio.c | 311 ++++++++++++++++++++++--------------- 3 files changed, 275 insertions(+), 184 deletions(-)drivers/bluetooth/btmrvl_debugfs.c +0
-0
drivers/bluetooth/btmrvl_debugfs.c void btmrvl_debugfs_init(struct hci_dev *hdev) · line 261
Quoted 6 lines
drivers/bluetooth/btmrvl_debugfs.c +2
-1@@ -257,7 +257,8 @@ void btmrvl_debugfs_init(struct hci_dev *hdev) priv->debugfs_data = dbg;if (!dbg) { -BT_ERR ("Can not allocate memory for btmrvl_debugfs_data." ); +btmrvl_dbg (priv->adapter,ERROR , +"Can not allocate memory for btmrvl_debugfs_data." );
Errors are not debug messages. The syntax for btmrvl_dbg is not correct. We can not have such a code merged upstream.
I am also feeling to see all this value with debug_mask and so on. The Linux kernel supports dynamic debug which is way more powerful than trying to invent your own mask based logging. And BT_DBG and other debug print functions are hooked into it. So why not use it.
If you prefer having some btmrvl_dev_info wrappers, then that seems reasonable, but they either map to BT_INFO or pr_dev_info or similar.
I would really prefer if this patch series gets re-thought and done the Linux kernel way.
Regards
Marcel
RE: [PATCH 4/4] Bluetooth: btmrvl: change debug prints to btmrvl_dbg
Hi Marcel,
Thanks for your review.
Quoted 9 lines
From: Marcel Holtmann [mailto:[email protected]]
Sent: Thursday, October 15, 2015 4:39 AM
To: Amitkumar Karwar
Cc: linux-bluetooth; Cathy Luo; Zhaoyang Liu
Subject: Re: [PATCH 4/4] Bluetooth: btmrvl: change debug prints tobtmrvl_dbg
=20
Hi Amitkumar,
=20
Quoted 6 lines
Quoted 2 lines
This patch changes all debug print from BT_INFO/BT_DBG/BT_ERR to marvell bluetooth driver specific debug functions.
=20
soBT_INFOandBT_ERRare not debug prints. They are genuine valid information that should be printed when something goes wrong or is informational.
We will correct the words.
Quoted 31 lines
=20
Quoted 8 lines
Signed-off-by Zhaoyang Liu <[email protected]>Signed-off-by Cathy Luo <[email protected]>Signed-off-by Amitkumar Karwar <[email protected]>---
drivers/bluetooth/btmrvl_debugfs.c | 3 +- drivers/bluetooth/btmrvl_main.c | 145 ++++++++++------- drivers/bluetooth/btmrvl_sdio.c | 311 ++++++++++++++++++++++---------------
Quoted 8 lines
3 files changed, 275 insertions(+), 184 deletions(-)drivers/bluetooth/btmrvl_debugfs.c +0
-0drivers/bluetooth/btmrvl_debugfs.c void btmrvl_debugfs_init(struct hci_dev *hdev) · line 261
Quoted 6 lines
drivers/bluetooth/btmrvl_debugfs.c +2
-1@@ -257,7 +257,8 @@ void btmrvl_debugfs_init(struct hci_dev *hdev) priv->debugfs_data =3D dbg;if (!dbg) { -BT_ERR ("Can not allocate memory for btmrvl_debugfs_data." ); + btmrvl_dbg(priv->adapter, ERROR, + "Can not allocate memory for
btmrvl_debugfs_data.");
=20
Errors are not debug messages. The syntax forbtmrvl_dbgis not correct. We can not have such a code merged upstream.
=20
I am also feeling to see all this value withdebug_maskand so on. The Linux kernel supports dynamic debug which is way more powerful than
Quoted 8 lines
trying to invent your own mask based logging. And
BT_DBGand other debug print functions are hooked into it. So why not use it.
=20
If you prefer having somebtmrvl_dev_infowrappers, then that seems reasonable, but they either map toBT_INFOorpr_dev_infoor similar. =20
I would really prefer if this patch series gets re-thought and done the Linux kernel way.
CONFIG_DYNAMIC_DEBUG compiler flag is not by default enabled on some of the=
platforms.=20
This was the reason we decided to implement this mask based logging. We do = have such implementation for our WLAN driver. Also, I can see similar thing=
in other driver in wireless subsystem.
Regards,
Amitkumar
Marcel Holtmann
maintainerRe: [PATCH 4/4] Bluetooth: btmrvl: change debug prints to btmrvl_dbg
Hi Amitkumar,
Quoted 52 lines
Quoted 7 lines
From: Marcel Holtmann [mailto:[email protected]]
Sent: Thursday, October 15, 2015 4:39 AM
To: Amitkumar Karwar
Cc: linux-bluetooth; Cathy Luo; Zhaoyang Liu
Subject: Re: [PATCH 4/4] Bluetooth: btmrvl: change debug prints tobtmrvl_dbgQuoted 8 lines
Hi Amitkumar,
Quoted 2 lines
This patch changes all debug print from BT_INFO/BT_DBG/BT_ERR to marvell bluetooth driver specific debug functions.
so
BT_INFOandBT_ERRare not debug prints. They are genuine valid information that should be printed when something goes wrong or is informational.We will correct the words.
Quoted 34 lines
Quoted 9 lines
Signed-off-by Zhaoyang Liu <[email protected]>Signed-off-by Cathy Luo <[email protected]>Signed-off-by Amitkumar Karwar <[email protected]>---
drivers/bluetooth/btmrvl_debugfs.c | 3 +- drivers/bluetooth/btmrvl_main.c | 145 ++++++++++------- drivers/bluetooth/btmrvl_sdio.c | 311 ++++++++++++++++++++++---------------
Quoted 8 lines
3 files changed, 275 insertions(+), 184 deletions(-)drivers/bluetooth/btmrvl_debugfs.c +0
-0drivers/bluetooth/btmrvl_debugfs.c void btmrvl_debugfs_init(struct hci_dev *hdev) · line 261
Quoted 6 lines
drivers/bluetooth/btmrvl_debugfs.c +2
-1@@ -257,7 +257,8 @@ void btmrvl_debugfs_init(struct hci_dev *hdev) priv->debugfs_data = dbg;if (!dbg) { -BT_ERR ("Can not allocate memory for btmrvl_debugfs_data." ); + btmrvl_dbg(priv->adapter, ERROR, + "Can not allocate memory for
btmrvl_debugfs_data.");Errors are not debug messages. The syntax for
btmrvl_dbgis not correct. We can not have such a code merged upstream.I am also feeling to see all this value with
debug_maskand so on. The Linux kernel supports dynamic debug which is way more powerful than trying to invent your own mask based logging. AndBT_DBGand other debug print functions are hooked into it. So why not use it.
Quoted 8 lines
Quoted 5 lines
If you prefer having some
btmrvl_dev_infowrappers, then that seems reasonable, but they either map toBT_INFOorpr_dev_infoor similar.I would really prefer if this patch series gets re-thought and done the Linux kernel way.
CONFIG_DYNAMIC_DEBUGcompiler flag is not by default enabled on some of the platforms.
This was the reason we decided to implement this mask based logging. We do have such implementation for our WLAN driver. Also, I can see similar thing in other driver in wireless subsystem.
and that is a good enough reason to duplicate functionality? My viewpoint is that it is not and that even wireless drivers should be cleaned up.
Regards
Marcel
RE: [PATCH 4/4] Bluetooth: btmrvl: change debug prints to btmrvl_dbg
Hi Marcel,
Quoted 72 lines
From: [email protected] [mailto:linux-bluetooth- [email protected]] On Behalf Of Marcel Holtmann
Sent: Thursday, October 15, 2015 8:21 PM
To: Amitkumar Karwar
Cc: linux-bluetooth; Cathy Luo; Zhaoyang Liu
Subject: Re: [PATCH 4/4] Bluetooth: btmrvl: change debug prints tobtmrvl_dbg
=20
Hi Amitkumar,
=20Quoted 9 lines
Quoted 9 lines
From: Marcel Holtmann [mailto:[email protected]]
Sent: Thursday, October 15, 2015 4:39 AM
To: Amitkumar Karwar
Cc: linux-bluetooth; Cathy Luo; Zhaoyang Liu
Subject: Re: [PATCH 4/4] Bluetooth: btmrvl: change debug prints tobtmrvl_dbgHi Amitkumar,
Quoted 18 lines
Quoted 6 lines
Quoted 2 lines
This patch changes all debug print from BT_INFO/BT_DBG/BT_ERR to marvell bluetooth driver specific debug functions.
so
BT_INFOandBT_ERRare not debug prints. They are genuine valid information that should be printed when something goes wrong or is informational.We will correct the words.
Quoted 9 lines
Quoted 9 lines
Signed-off-by Zhaoyang Liu <[email protected]>Signed-off-by Cathy Luo <[email protected]>Signed-off-by Amitkumar Karwar <[email protected]>---
drivers/bluetooth/btmrvl_debugfs.c | 3 +- drivers/bluetooth/btmrvl_main.c | 145 ++++++++++------- drivers/bluetooth/btmrvl_sdio.c | 311 ++++++++++++++++++++++-------
Quoted 11 lines
Quoted 11 lines
--------
Quoted 10 lines
3 files changed, 275 insertions(+), 184 deletions(-)drivers/bluetooth/btmrvl_debugfs.c +0
-0@@ -257,7 +257,8 @@ void btmrvl_debugfs_init(struct hci_dev *hdev) priv->debugfs_data =3D dbg;Quoted 7 lines
Quoted 7 lines
drivers/bluetooth/btmrvl_debugfs.c void btmrvl_debugfs_init(struct hci_dev *hdev)
Quoted 4 lines
drivers/bluetooth/btmrvl_debugfs.c +2
-1if (!dbg) { -BT_ERR ("Can not allocate memory for btmrvl_debugfs_data." ); + btmrvl_dbg(priv->adapter, ERROR, + "Can not allocate memory for
btmrvl_debugfs_data.");Errors are not debug messages. The syntax for
btmrvl_dbgis notcorrect.
Quoted 7 lines
Quoted 7 lines
We can not have such a code merged upstream.
I am also feeling to see all this value with
debug_maskand so on. The Linux kernel supports dynamic debug which is way more powerful than trying to invent your own mask based logging. AndBT_DBGand other debug print functions are hooked into it. So why not use it.Quoted 7 lines
Quoted 5 lines
If you prefer having some
btmrvl_dev_infowrappers, then that seems reasonable, but they either map toBT_INFOorpr_dev_infoor similar.I would really prefer if this patch series gets re-thought and done the Linux kernel way.
CONFIG_DYNAMIC_DEBUGcompiler flag is not by default enabled on someof the platforms.
Quoted 8 lines
Quoted 1 line
This was the reason we decided to implement this mask based logging.
We do have such implementation for our WLAN driver. Also, I can see similar thing in other driver in wireless subsystem.
=20
and that is a good enough reason to duplicate functionality? My viewpoint is that it is not and that even wireless drivers should be cleaned up.
=20
This has been implemented this just to get logs for the issues reported by = end user where DYNAMIC DEBUG is not enabled.
If isn't a standard way in Linux kernel, please drop these patches. I suppose you can still consider 1/4.
Regards,
Amit
Marcel Holtmann
maintainerHi Amitkumar,
Quoted 15 lines
These changes resolve below checkpatch warning
WARNING: Possible unnecessary 'out of memory' message
Signed-off-by Amitkumar Karwar <[email protected]>---
drivers/bluetooth/btmrvl_main.c| 8 ++------drivers/bluetooth/btmrvl_sdio.c| 5 ++---2 files changed, 4 insertions(+), 9 deletions(-)drivers/bluetooth/btmrvl_main.c +0
-0
drivers/bluetooth/btmrvl_main.c struct btmrvl_private *btmrvl_add_card(void *card) · line 718
Quoted 8 lines
drivers/bluetooth/btmrvl_main.c +1
-3@@ -712,16 +712,12 @@ struct btmrvl_private *btmrvl_add_card(void *card)struct btmrvl_private *priv; priv =kzalloc (sizeof (*priv),GFP_KERNEL ); -if (!priv) { -BT_ERR ("Can not allocate priv" ); +if (!priv) goto err_priv; - }
I do not get these checkpatch fixes. Why is the error messages unneeded?
Regards
Marcel
Hi Marcel,
Quoted 27 lines
From: Marcel Holtmann [mailto:[email protected]]
Sent: Thursday, October 15, 2015 4:29 AM
To: Amitkumar Karwar
Cc: [email protected]; Cathy Luo
Subject: Re: [PATCH 1/4] Bluetooth: btmrvl: remove memory allocation failure message
=20
Hi Amitkumar,
=20drivers/bluetooth/btmrvl_main.c struct btmrvl_private *btmrvl_add_card(void
Quoted 15 lines
These changes resolve below checkpatch warning
WARNING: Possible unnecessary 'out of memory' message
Signed-off-by Amitkumar Karwar <[email protected]>---
drivers/bluetooth/btmrvl_main.c| 8 ++------drivers/bluetooth/btmrvl_sdio.c| 5 ++---2 files changed, 4 insertions(+), 9 deletions(-)(quoted diff) +0
-0
b/drivers/bluetooth/btmrvl_main.cindex 6ba2286..61d2f39 100644drivers/bluetooth/btmrvl_main.c +0
-0@@ -712,16 +712,12 @@ struct btmrvl_private *btmrvl_add_card(void*card)
Quoted 2 lines
drivers/bluetooth/btmrvl_main.c +0
-0struct btmrvl_private *priv;
Quoted 9 lines
drivers/bluetooth/btmrvl_main.c struct btmrvl_private *btmrvl_add_card(void *card) · line 718
Quoted 6 lines
drivers/bluetooth/btmrvl_main.c +1
-3priv =3D kzalloc(sizeof(*priv), GFP_KERNEL); -if (!priv) { -BT_ERR ("Can not allocate priv" ); +if (!priv) goto err_priv; - }=20
I do not get these checkpatch fixes. Why is the error messages unneeded? =20
Linux kernel already displays a generic message and stack dump in this case= . So this error message would be redundant.
More details on checkpatch code change: http://lkml.iu.edu/hypermail/linux/=kernel/1406.1/01508.html
Regards,
Amitkumar
Marcel Holtmann
maintainerHi Amitkumar,
Quoted 28 lines
Quoted 18 lines
drivers/bluetooth/btmrvl_main.c struct btmrvl_private *btmrvl_add_card(void
Quoted 15 lines
These changes resolve below checkpatch warning
WARNING: Possible unnecessary 'out of memory' message
Signed-off-by Amitkumar Karwar <[email protected]>---
drivers/bluetooth/btmrvl_main.c| 8 ++------drivers/bluetooth/btmrvl_sdio.c| 5 ++---2 files changed, 4 insertions(+), 9 deletions(-)(quoted diff) +0
-0
b/drivers/bluetooth/btmrvl_main.cindex 6ba2286..61d2f39 100644drivers/bluetooth/btmrvl_main.c +0
-0@@ -712,16 +712,12 @@ struct btmrvl_private *btmrvl_add_card(void*card)
Quoted 2 lines
drivers/bluetooth/btmrvl_main.c +0
-0struct btmrvl_private *priv;Quoted 9 lines
drivers/bluetooth/btmrvl_main.c struct btmrvl_private *btmrvl_add_card(void *card) · line 718
Quoted 6 lines
drivers/bluetooth/btmrvl_main.c +1
-3priv =kzalloc (sizeof (*priv),GFP_KERNEL ); -if (!priv) { -BT_ERR ("Can not allocate priv" ); +if (!priv) goto err_priv; - }I do not get these checkpatch fixes. Why is the error messages unneeded?
Quoted 2 lines
Linux kernel already displays a generic message and stack dump in this case. So this error message would be redundant. More details on checkpatch code change: http://lkml.iu.edu/hypermail/linux/kernel/1406.1/01508.html
fair enough. I can accept this premise.
Regards
Marcel