linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bluetooth: remove useless variable in virtual hci driver
@ 2009-10-23 23:29 Thadeu Lima de Souza Cascardo
  2009-10-24  8:41 ` Marcel Holtmann
  0 siblings, 1 reply; 3+ messages in thread
From: Thadeu Lima de Souza Cascardo @ 2009-10-23 23:29 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: linux-kernel, marcel, Thadeu Lima de Souza Cascardo

Commit ac28494c has removed the option to give a minor number as
parameter for VHCI driver. Remove the variable used for that parameter.
Print the error code when registering the device fails, instead of the
requested minor number (which would always be MISC_DYNAMIC_MINOR).

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
---
 drivers/bluetooth/hci_vhci.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
index d5cde6d..74c094c 100644
--- a/drivers/bluetooth/hci_vhci.c
+++ b/drivers/bluetooth/hci_vhci.c
@@ -41,8 +41,6 @@
 
 #define VERSION "1.3"
 
-static int minor = MISC_DYNAMIC_MINOR;
-
 struct vhci_data {
 	struct hci_dev *hdev;
 
@@ -292,7 +290,7 @@ static const struct file_operations vhci_fops = {
 	.release	= vhci_release,
 };
 
-static struct miscdevice vhci_miscdev= {
+static struct miscdevice vhci_miscdev = {
 	.name	= "vhci",
 	.fops	= &vhci_fops,
 	.minor	= MISC_DYNAMIC_MINOR,
@@ -300,10 +298,13 @@ static struct miscdevice vhci_miscdev= {
 
 static int __init vhci_init(void)
 {
+	int r;
+
 	BT_INFO("Virtual HCI driver ver %s", VERSION);
 
-	if (misc_register(&vhci_miscdev) < 0) {
-		BT_ERR("Can't register misc device with minor %d", minor);
+	r = misc_register(&vhci_miscdev);
+	if (r < 0) {
+		BT_ERR("Can't register misc device: %d", r);
 		return -EIO;
 	}
 
@@ -312,8 +313,10 @@ static int __init vhci_init(void)
 
 static void __exit vhci_exit(void)
 {
-	if (misc_deregister(&vhci_miscdev) < 0)
-		BT_ERR("Can't unregister misc device with minor %d", minor);
+	int r;
+	r = misc_deregister(&vhci_miscdev);
+	if (r < 0)
+		BT_ERR("Can't unregister misc device: %d", r);
 }
 
 module_init(vhci_init);
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] bluetooth: remove useless variable in virtual hci driver
  2009-10-23 23:29 [PATCH] bluetooth: remove useless variable in virtual hci driver Thadeu Lima de Souza Cascardo
@ 2009-10-24  8:41 ` Marcel Holtmann
  0 siblings, 0 replies; 3+ messages in thread
From: Marcel Holtmann @ 2009-10-24  8:41 UTC (permalink / raw)
  To: Thadeu Lima de Souza Cascardo; +Cc: linux-bluetooth, linux-kernel

Hi Thadeu,

> Commit ac28494c has removed the option to give a minor number as
> parameter for VHCI driver. Remove the variable used for that parameter.
> Print the error code when registering the device fails, instead of the
> requested minor number (which would always be MISC_DYNAMIC_MINOR).

I see the point in removing the variable. That is clearly a leftover,
but what is the error code printing for? That is pointless since we can
just return misc_register(&vhci_miscdev); since it is the module loading
function. And in the exit module case I don't care. The misc_deregister
should not return an error to begin with. It is pointless. Fix up the
patch and re-sent it.

Regards

Marcel



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] bluetooth: remove useless variable in virtual hci driver
@ 2009-10-26 15:59 Thadeu Lima de Souza Cascardo
  0 siblings, 0 replies; 3+ messages in thread
From: Thadeu Lima de Souza Cascardo @ 2009-10-26 15:59 UTC (permalink / raw)
  To: marcel; +Cc: linux-kernel, linux-bluetooth, Thadeu Lima de Souza Cascardo

Commit ac28494c has removed the option to give a minor number as
parameter for VHCI driver. Remove the variable used for that parameter.
Printing the requested minor number, which would always be
MISC_DYNAMIC_MINOR, is not needed. And return the error code returned by
misc_register, instead of -EIO in init function.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
---
 drivers/bluetooth/hci_vhci.c |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
index d5cde6d..8fed210 100644
--- a/drivers/bluetooth/hci_vhci.c
+++ b/drivers/bluetooth/hci_vhci.c
@@ -41,8 +41,6 @@
 
 #define VERSION "1.3"
 
-static int minor = MISC_DYNAMIC_MINOR;
-
 struct vhci_data {
 	struct hci_dev *hdev;
 
@@ -292,7 +290,7 @@ static const struct file_operations vhci_fops = {
 	.release	= vhci_release,
 };
 
-static struct miscdevice vhci_miscdev= {
+static struct miscdevice vhci_miscdev = {
 	.name	= "vhci",
 	.fops	= &vhci_fops,
 	.minor	= MISC_DYNAMIC_MINOR,
@@ -301,19 +299,12 @@ static struct miscdevice vhci_miscdev= {
 static int __init vhci_init(void)
 {
 	BT_INFO("Virtual HCI driver ver %s", VERSION);
-
-	if (misc_register(&vhci_miscdev) < 0) {
-		BT_ERR("Can't register misc device with minor %d", minor);
-		return -EIO;
-	}
-
-	return 0;
+	return misc_register(&vhci_miscdev);
 }
 
 static void __exit vhci_exit(void)
 {
-	if (misc_deregister(&vhci_miscdev) < 0)
-		BT_ERR("Can't unregister misc device with minor %d", minor);
+	misc_deregister(&vhci_miscdev);
 }
 
 module_init(vhci_init);
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-10-26 15:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-23 23:29 [PATCH] bluetooth: remove useless variable in virtual hci driver Thadeu Lima de Souza Cascardo
2009-10-24  8:41 ` Marcel Holtmann
  -- strict thread matches above, loose matches on Subject: below --
2009-10-26 15:59 Thadeu Lima de Souza Cascardo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).