All of lore.kernel.org
 help / color / mirror / Atom feed
* prepatch: Fix brf6510 cleanup code
@ 2009-05-30 17:07 Andrew de Quincey
  2009-06-08 20:03 ` [patch] " Andrew de Quincey
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew de Quincey @ 2009-05-30 17:07 UTC (permalink / raw)
  To: linux-omap

[-- Attachment #1: Type: text/plain, Size: 159 bytes --]

Hi, another cleanup patch from me; this one fixes the brf6150 cleanup  
code so the module can be unloaded cleanly and also doesn't cause an  
oops on reset.


[-- Attachment #2: brf6150-cleanup-fix.patch --]
[-- Type: text/x-patch, Size: 3354 bytes --]

commit bf0e4cba53819df5590a88d551b35a2e79f4de75
Author: Andrew de Quincey <adq@lidskialf.net>
Date:   Sat May 30 18:01:58 2009 +0100

    Fix brf6150 init/shutdown cleanup

diff --git a/drivers/bluetooth/brf6150.c b/drivers/bluetooth/brf6150.c
index f29caf5..4f0112a 100644
--- a/drivers/bluetooth/brf6150.c
+++ b/drivers/bluetooth/brf6150.c
@@ -312,7 +312,7 @@ static int brf6150_send_negotiation(struct brf6150_info *info)
 	skb = brf6150_read_fw_cmd(info, GFP_KERNEL);
 
 	if (!skb) {
-		printk(KERN_WARNING "Cannot read negoatiation message");
+		printk(KERN_WARNING "Cannot read negotiation message");
 		return -1;
 	}
 
@@ -873,6 +873,7 @@ static int brf6150_register_hdev(struct brf6150_info *info)
 	hdev->owner = THIS_MODULE;
 
 	if (hci_register_dev(hdev) < 0) {
+		hci_free_dev(hdev);
 		printk(KERN_WARNING "brf6150: Can't register HCI device %s.\n", hdev->name);
 		return -ENODEV;
 	}
@@ -885,10 +886,9 @@ static int __init brf6150_init(void)
 	struct brf6150_info *info;
 	int irq, err;
 
-	info = kmalloc(sizeof(struct brf6150_info), GFP_KERNEL);
+	info = kzalloc(sizeof(struct brf6150_info), GFP_KERNEL);
 	if (!info)
 		return -ENOMEM;
-	memset(info, 0, sizeof(struct brf6150_info));
 
 	brf6150_device.dev.driver_data = info;
 	init_completion(&info->init_completion);
@@ -906,8 +906,11 @@ static int __init brf6150_init(void)
 	exit_info = NULL;
 
 	info->btinfo = omap_get_config(OMAP_TAG_NOKIA_BT, struct omap_bluetooth_config);
-	if (info->btinfo == NULL)
+	if (info->btinfo == NULL) {
+		tasklet_kill(&info->tx_task);
+		kfree(info);
 		return -1;
+	}
 
 	NBT_DBG("RESET gpio: %d\n", info->btinfo->reset_gpio);
 	NBT_DBG("BTWU gpio: %d\n", info->btinfo->bt_wakeup_gpio);
@@ -920,6 +923,7 @@ static int __init brf6150_init(void)
 	{
 		printk(KERN_WARNING "Cannot get GPIO line %d", 
 		       info->btinfo->reset_gpio);
+		tasklet_kill(&info->tx_task);
 		kfree(info);
 		return err;
 	}
@@ -930,6 +934,7 @@ static int __init brf6150_init(void)
 		printk(KERN_WARNING "Cannot get GPIO line 0x%d",
 		       info->btinfo->bt_wakeup_gpio);
 		gpio_free(info->btinfo->reset_gpio);
+		tasklet_kill(&info->tx_task);
 		kfree(info);
 		return err;
 	}
@@ -941,6 +946,7 @@ static int __init brf6150_init(void)
 		       info->btinfo->host_wakeup_gpio);
 		gpio_free(info->btinfo->reset_gpio);
 		gpio_free(info->btinfo->bt_wakeup_gpio);
+		tasklet_kill(&info->tx_task);
 		kfree(info);
 		return err;
 	}
@@ -1027,6 +1033,7 @@ cleanup:
 	gpio_free(info->btinfo->reset_gpio);
 	gpio_free(info->btinfo->bt_wakeup_gpio);
 	gpio_free(info->btinfo->host_wakeup_gpio);
+	tasklet_kill(&info->tx_task);
 	kfree(info);
 
 	return err;
@@ -1035,12 +1042,16 @@ cleanup:
 static void __exit brf6150_exit(void)
 {
 	brf6150_hci_close(exit_info->hdev);
+	hci_unregister_dev(exit_info->hdev);
 	hci_free_dev(exit_info->hdev);
 	gpio_free(exit_info->btinfo->reset_gpio);
 	gpio_free(exit_info->btinfo->bt_wakeup_gpio);
 	gpio_free(exit_info->btinfo->host_wakeup_gpio);
 	free_irq(exit_info->irq, (void *)exit_info);
 	free_irq(gpio_to_irq(exit_info->btinfo->host_wakeup_gpio), (void *)exit_info);
+	tasklet_kill(&exit_info->tx_task);
+	platform_device_unregister(&brf6150_device);
+	platform_driver_unregister(&brf6150_driver);
 	kfree(exit_info);
 }
 

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

* [patch] Fix brf6510 cleanup code
  2009-05-30 17:07 prepatch: Fix brf6510 cleanup code Andrew de Quincey
@ 2009-06-08 20:03 ` Andrew de Quincey
  2009-06-15  8:02   ` Tony Lindgren
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew de Quincey @ 2009-06-08 20:03 UTC (permalink / raw)
  To: linux-omap

[-- Attachment #1: Type: text/plain, Size: 157 bytes --]

The brf6150 driver is missing several necessary cleanup steps to allow  
module unloading. Add them.


Signed-off-by: Andrew de Quincey <adq@lidskialf.net>


[-- Attachment #2: brf6510-cleanup-fix.patch --]
[-- Type: text/x-patch, Size: 3354 bytes --]

commit bf0e4cba53819df5590a88d551b35a2e79f4de75
Author: Andrew de Quincey <adq@lidskialf.net>
Date:   Sat May 30 18:01:58 2009 +0100

    Fix brf6150 init/shutdown cleanup

diff --git a/drivers/bluetooth/brf6150.c b/drivers/bluetooth/brf6150.c
index f29caf5..4f0112a 100644
--- a/drivers/bluetooth/brf6150.c
+++ b/drivers/bluetooth/brf6150.c
@@ -312,7 +312,7 @@ static int brf6150_send_negotiation(struct brf6150_info *info)
 	skb = brf6150_read_fw_cmd(info, GFP_KERNEL);
 
 	if (!skb) {
-		printk(KERN_WARNING "Cannot read negoatiation message");
+		printk(KERN_WARNING "Cannot read negotiation message");
 		return -1;
 	}
 
@@ -873,6 +873,7 @@ static int brf6150_register_hdev(struct brf6150_info *info)
 	hdev->owner = THIS_MODULE;
 
 	if (hci_register_dev(hdev) < 0) {
+		hci_free_dev(hdev);
 		printk(KERN_WARNING "brf6150: Can't register HCI device %s.\n", hdev->name);
 		return -ENODEV;
 	}
@@ -885,10 +886,9 @@ static int __init brf6150_init(void)
 	struct brf6150_info *info;
 	int irq, err;
 
-	info = kmalloc(sizeof(struct brf6150_info), GFP_KERNEL);
+	info = kzalloc(sizeof(struct brf6150_info), GFP_KERNEL);
 	if (!info)
 		return -ENOMEM;
-	memset(info, 0, sizeof(struct brf6150_info));
 
 	brf6150_device.dev.driver_data = info;
 	init_completion(&info->init_completion);
@@ -906,8 +906,11 @@ static int __init brf6150_init(void)
 	exit_info = NULL;
 
 	info->btinfo = omap_get_config(OMAP_TAG_NOKIA_BT, struct omap_bluetooth_config);
-	if (info->btinfo == NULL)
+	if (info->btinfo == NULL) {
+		tasklet_kill(&info->tx_task);
+		kfree(info);
 		return -1;
+	}
 
 	NBT_DBG("RESET gpio: %d\n", info->btinfo->reset_gpio);
 	NBT_DBG("BTWU gpio: %d\n", info->btinfo->bt_wakeup_gpio);
@@ -920,6 +923,7 @@ static int __init brf6150_init(void)
 	{
 		printk(KERN_WARNING "Cannot get GPIO line %d", 
 		       info->btinfo->reset_gpio);
+		tasklet_kill(&info->tx_task);
 		kfree(info);
 		return err;
 	}
@@ -930,6 +934,7 @@ static int __init brf6150_init(void)
 		printk(KERN_WARNING "Cannot get GPIO line 0x%d",
 		       info->btinfo->bt_wakeup_gpio);
 		gpio_free(info->btinfo->reset_gpio);
+		tasklet_kill(&info->tx_task);
 		kfree(info);
 		return err;
 	}
@@ -941,6 +946,7 @@ static int __init brf6150_init(void)
 		       info->btinfo->host_wakeup_gpio);
 		gpio_free(info->btinfo->reset_gpio);
 		gpio_free(info->btinfo->bt_wakeup_gpio);
+		tasklet_kill(&info->tx_task);
 		kfree(info);
 		return err;
 	}
@@ -1027,6 +1033,7 @@ cleanup:
 	gpio_free(info->btinfo->reset_gpio);
 	gpio_free(info->btinfo->bt_wakeup_gpio);
 	gpio_free(info->btinfo->host_wakeup_gpio);
+	tasklet_kill(&info->tx_task);
 	kfree(info);
 
 	return err;
@@ -1035,12 +1042,16 @@ cleanup:
 static void __exit brf6150_exit(void)
 {
 	brf6150_hci_close(exit_info->hdev);
+	hci_unregister_dev(exit_info->hdev);
 	hci_free_dev(exit_info->hdev);
 	gpio_free(exit_info->btinfo->reset_gpio);
 	gpio_free(exit_info->btinfo->bt_wakeup_gpio);
 	gpio_free(exit_info->btinfo->host_wakeup_gpio);
 	free_irq(exit_info->irq, (void *)exit_info);
 	free_irq(gpio_to_irq(exit_info->btinfo->host_wakeup_gpio), (void *)exit_info);
+	tasklet_kill(&exit_info->tx_task);
+	platform_device_unregister(&brf6150_device);
+	platform_driver_unregister(&brf6150_driver);
 	kfree(exit_info);
 }
 

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

* Re: [patch] Fix brf6510 cleanup code
  2009-06-08 20:03 ` [patch] " Andrew de Quincey
@ 2009-06-15  8:02   ` Tony Lindgren
  2009-06-15  8:38     ` Ville Tervo
  0 siblings, 1 reply; 6+ messages in thread
From: Tony Lindgren @ 2009-06-15  8:02 UTC (permalink / raw)
  To: Andrew de Quincey, Tervo Ville (NMP/Helsinki); +Cc: linux-omap

* Andrew de Quincey <adq_dvb@lidskialf.net> [090608 13:04]:
> The brf6150 driver is missing several necessary cleanup steps to allow  
> module unloading. Add them.

I've removed the brf6150 from linux-omap as this should get merged into
the mainline kernel via bt list.

Ville & Andrew, can you guys please coordinate on the bt list to get
the driver merged in? I believe there were some changes needed for
passing the hw address as a module option and for loading the firmware
or something..

Thanks,

Tony

> Signed-off-by: Andrew de Quincey <adq@lidskialf.net>
>

> commit bf0e4cba53819df5590a88d551b35a2e79f4de75
> Author: Andrew de Quincey <adq@lidskialf.net>
> Date:   Sat May 30 18:01:58 2009 +0100
> 
>     Fix brf6150 init/shutdown cleanup
> 
> diff --git a/drivers/bluetooth/brf6150.c b/drivers/bluetooth/brf6150.c
> index f29caf5..4f0112a 100644
> --- a/drivers/bluetooth/brf6150.c
> +++ b/drivers/bluetooth/brf6150.c
> @@ -312,7 +312,7 @@ static int brf6150_send_negotiation(struct brf6150_info *info)
>  	skb = brf6150_read_fw_cmd(info, GFP_KERNEL);
>  
>  	if (!skb) {
> -		printk(KERN_WARNING "Cannot read negoatiation message");
> +		printk(KERN_WARNING "Cannot read negotiation message");
>  		return -1;
>  	}
>  
> @@ -873,6 +873,7 @@ static int brf6150_register_hdev(struct brf6150_info *info)
>  	hdev->owner = THIS_MODULE;
>  
>  	if (hci_register_dev(hdev) < 0) {
> +		hci_free_dev(hdev);
>  		printk(KERN_WARNING "brf6150: Can't register HCI device %s.\n", hdev->name);
>  		return -ENODEV;
>  	}
> @@ -885,10 +886,9 @@ static int __init brf6150_init(void)
>  	struct brf6150_info *info;
>  	int irq, err;
>  
> -	info = kmalloc(sizeof(struct brf6150_info), GFP_KERNEL);
> +	info = kzalloc(sizeof(struct brf6150_info), GFP_KERNEL);
>  	if (!info)
>  		return -ENOMEM;
> -	memset(info, 0, sizeof(struct brf6150_info));
>  
>  	brf6150_device.dev.driver_data = info;
>  	init_completion(&info->init_completion);
> @@ -906,8 +906,11 @@ static int __init brf6150_init(void)
>  	exit_info = NULL;
>  
>  	info->btinfo = omap_get_config(OMAP_TAG_NOKIA_BT, struct omap_bluetooth_config);
> -	if (info->btinfo == NULL)
> +	if (info->btinfo == NULL) {
> +		tasklet_kill(&info->tx_task);
> +		kfree(info);
>  		return -1;
> +	}
>  
>  	NBT_DBG("RESET gpio: %d\n", info->btinfo->reset_gpio);
>  	NBT_DBG("BTWU gpio: %d\n", info->btinfo->bt_wakeup_gpio);
> @@ -920,6 +923,7 @@ static int __init brf6150_init(void)
>  	{
>  		printk(KERN_WARNING "Cannot get GPIO line %d", 
>  		       info->btinfo->reset_gpio);
> +		tasklet_kill(&info->tx_task);
>  		kfree(info);
>  		return err;
>  	}
> @@ -930,6 +934,7 @@ static int __init brf6150_init(void)
>  		printk(KERN_WARNING "Cannot get GPIO line 0x%d",
>  		       info->btinfo->bt_wakeup_gpio);
>  		gpio_free(info->btinfo->reset_gpio);
> +		tasklet_kill(&info->tx_task);
>  		kfree(info);
>  		return err;
>  	}
> @@ -941,6 +946,7 @@ static int __init brf6150_init(void)
>  		       info->btinfo->host_wakeup_gpio);
>  		gpio_free(info->btinfo->reset_gpio);
>  		gpio_free(info->btinfo->bt_wakeup_gpio);
> +		tasklet_kill(&info->tx_task);
>  		kfree(info);
>  		return err;
>  	}
> @@ -1027,6 +1033,7 @@ cleanup:
>  	gpio_free(info->btinfo->reset_gpio);
>  	gpio_free(info->btinfo->bt_wakeup_gpio);
>  	gpio_free(info->btinfo->host_wakeup_gpio);
> +	tasklet_kill(&info->tx_task);
>  	kfree(info);
>  
>  	return err;
> @@ -1035,12 +1042,16 @@ cleanup:
>  static void __exit brf6150_exit(void)
>  {
>  	brf6150_hci_close(exit_info->hdev);
> +	hci_unregister_dev(exit_info->hdev);
>  	hci_free_dev(exit_info->hdev);
>  	gpio_free(exit_info->btinfo->reset_gpio);
>  	gpio_free(exit_info->btinfo->bt_wakeup_gpio);
>  	gpio_free(exit_info->btinfo->host_wakeup_gpio);
>  	free_irq(exit_info->irq, (void *)exit_info);
>  	free_irq(gpio_to_irq(exit_info->btinfo->host_wakeup_gpio), (void *)exit_info);
> +	tasklet_kill(&exit_info->tx_task);
> +	platform_device_unregister(&brf6150_device);
> +	platform_driver_unregister(&brf6150_driver);
>  	kfree(exit_info);
>  }
>  

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

* Re: [patch] Fix brf6510 cleanup code
  2009-06-15  8:02   ` Tony Lindgren
@ 2009-06-15  8:38     ` Ville Tervo
  2009-06-15  8:58       ` Tony Lindgren
  0 siblings, 1 reply; 6+ messages in thread
From: Ville Tervo @ 2009-06-15  8:38 UTC (permalink / raw)
  To: ext Tony Lindgren; +Cc: Andrew de Quincey, linux-omap

Hi Andrew,

ext Tony Lindgren wrote:
> * Andrew de Quincey <adq_dvb@lidskialf.net> [090608 13:04]:
>> The brf6150 driver is missing several necessary cleanup steps to allow  
>> module unloading. Add them.

Yes. This driver was used as compiled in driver and seems to be missing 
cleanups.

As you may have noticed this brf6150 driver has been replaced by hci_h4p 
drier in later tablets and the easiest way to maintain support for Nokia 
770 bluetooth would be to make sure that also brf6150 works with the 
current driver. AFAIK it should work with quite little modifications. 
The settings negotiation is a little bit different.

> 
> I've removed the brf6150 from linux-omap as this should get merged into
> the mainline kernel via bt list.
> 
> Ville & Andrew, can you guys please coordinate on the bt list to get
> the driver merged in? I believe there were some changes needed for
> passing the hw address as a module option and for loading the firmware
> or something..

Is 2.6.30 booting in Nokia 770/N800/N810? If so then I guess this should 
be quite easy task.

-- 
Ville

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

* Re: [patch] Fix brf6510 cleanup code
  2009-06-15  8:38     ` Ville Tervo
@ 2009-06-15  8:58       ` Tony Lindgren
  2009-06-15  9:53         ` Tony Lindgren
  0 siblings, 1 reply; 6+ messages in thread
From: Tony Lindgren @ 2009-06-15  8:58 UTC (permalink / raw)
  To: Ville Tervo; +Cc: Andrew de Quincey, linux-omap

* Ville Tervo <ville.tervo@nokia.com> [090615 01:39]:
> Hi Andrew,
>
> ext Tony Lindgren wrote:
>> * Andrew de Quincey <adq_dvb@lidskialf.net> [090608 13:04]:
>>> The brf6150 driver is missing several necessary cleanup steps to 
>>> allow  module unloading. Add them.
>
> Yes. This driver was used as compiled in driver and seems to be missing  
> cleanups.
>
> As you may have noticed this brf6150 driver has been replaced by hci_h4p  
> drier in later tablets and the easiest way to maintain support for Nokia  
> 770 bluetooth would be to make sure that also brf6150 works with the  
> current driver. AFAIK it should work with quite little modifications.  
> The settings negotiation is a little bit different.
>
>>
>> I've removed the brf6150 from linux-omap as this should get merged into
>> the mainline kernel via bt list.
>>
>> Ville & Andrew, can you guys please coordinate on the bt list to get
>> the driver merged in? I believe there were some changes needed for
>> passing the hw address as a module option and for loading the firmware
>> or something..
>
> Is 2.6.30 booting in Nokia 770/N800/N810? If so then I guess this should  
> be quite easy task.

No.. The board files are missing, drivers/cbus is missing, and the code
depends on omap specific ATAGs. Hopefully we can get the minimal support
into 2.6.31 though.

Tony

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

* Re: [patch] Fix brf6510 cleanup code
  2009-06-15  8:58       ` Tony Lindgren
@ 2009-06-15  9:53         ` Tony Lindgren
  0 siblings, 0 replies; 6+ messages in thread
From: Tony Lindgren @ 2009-06-15  9:53 UTC (permalink / raw)
  To: Ville Tervo; +Cc: Andrew de Quincey, linux-omap

* Tony Lindgren <tony@atomide.com> [090615 02:00]:
> * Ville Tervo <ville.tervo@nokia.com> [090615 01:39]:
> > Hi Andrew,
> >
> > ext Tony Lindgren wrote:
> >> * Andrew de Quincey <adq_dvb@lidskialf.net> [090608 13:04]:
> >>> The brf6150 driver is missing several necessary cleanup steps to 
> >>> allow  module unloading. Add them.
> >
> > Yes. This driver was used as compiled in driver and seems to be missing  
> > cleanups.
> >
> > As you may have noticed this brf6150 driver has been replaced by hci_h4p  
> > drier in later tablets and the easiest way to maintain support for Nokia  
> > 770 bluetooth would be to make sure that also brf6150 works with the  
> > current driver. AFAIK it should work with quite little modifications.  
> > The settings negotiation is a little bit different.
> >
> >>
> >> I've removed the brf6150 from linux-omap as this should get merged into
> >> the mainline kernel via bt list.
> >>
> >> Ville & Andrew, can you guys please coordinate on the bt list to get
> >> the driver merged in? I believe there were some changes needed for
> >> passing the hw address as a module option and for loading the firmware
> >> or something..
> >
> > Is 2.6.30 booting in Nokia 770/N800/N810? If so then I guess this should  
> > be quite easy task.
> 
> No.. The board files are missing, drivers/cbus is missing, and the code
> depends on omap specific ATAGs. Hopefully we can get the minimal support
> into 2.6.31 though.

Correction, hopefully we'll get the minimal support into 2.6.32, not 31.
 
> Tony
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2009-06-15  9:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-30 17:07 prepatch: Fix brf6510 cleanup code Andrew de Quincey
2009-06-08 20:03 ` [patch] " Andrew de Quincey
2009-06-15  8:02   ` Tony Lindgren
2009-06-15  8:38     ` Ville Tervo
2009-06-15  8:58       ` Tony Lindgren
2009-06-15  9:53         ` Tony Lindgren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.