linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] bluetooth: hci_bcm: enable IRQ capability from node
@ 2019-12-11  9:49 Guillaume La Roque
  2019-12-11 10:18 ` Marcel Holtmann
  2019-12-12 17:28 ` Nicolas Saenz Julienne
  0 siblings, 2 replies; 7+ messages in thread
From: Guillaume La Roque @ 2019-12-11  9:49 UTC (permalink / raw)
  To: marcel, johan.hedberg, linux-bluetooth; +Cc: linux-kernel, khilman

Actually IRQ can be found from GPIO but all platforms don't support
gpiod_to_irq, it's the case on amlogic chip.
so to have possibility to use interrupt mode we need to add interrupts
field in node and support it in driver.

Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
---
 drivers/bluetooth/hci_bcm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
index f8f5c593a05c..9f52d57c56de 100644
--- a/drivers/bluetooth/hci_bcm.c
+++ b/drivers/bluetooth/hci_bcm.c
@@ -1409,6 +1409,7 @@ static int bcm_serdev_probe(struct serdev_device *serdev)
 {
 	struct bcm_device *bcmdev;
 	const struct bcm_device_data *data;
+	struct platform_device *pdev;
 	int err;
 
 	bcmdev = devm_kzalloc(&serdev->dev, sizeof(*bcmdev), GFP_KERNEL);
@@ -1421,6 +1422,8 @@ static int bcm_serdev_probe(struct serdev_device *serdev)
 #endif
 	bcmdev->serdev_hu.serdev = serdev;
 	serdev_device_set_drvdata(serdev, bcmdev);
+	pdev = to_platform_device(bcmdev->dev);
+	bcmdev->irq = platform_get_irq(pdev, 0);
 
 	/* Initialize routing field to an unused value */
 	bcmdev->pcm_int_params[0] = 0xff;
-- 
2.17.1


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

* Re: [PATCH v3] bluetooth: hci_bcm: enable IRQ capability from node
  2019-12-11  9:49 [PATCH v3] bluetooth: hci_bcm: enable IRQ capability from node Guillaume La Roque
@ 2019-12-11 10:18 ` Marcel Holtmann
  2019-12-12 17:28 ` Nicolas Saenz Julienne
  1 sibling, 0 replies; 7+ messages in thread
From: Marcel Holtmann @ 2019-12-11 10:18 UTC (permalink / raw)
  To: Guillaume La Roque; +Cc: Johan Hedberg, linux-bluetooth, linux-kernel, khilman

Hi Guillaume,

> Actually IRQ can be found from GPIO but all platforms don't support
> gpiod_to_irq, it's the case on amlogic chip.
> so to have possibility to use interrupt mode we need to add interrupts
> field in node and support it in driver.
> 
> Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
> ---
> drivers/bluetooth/hci_bcm.c | 3 +++
> 1 file changed, 3 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

* Re: [PATCH v3] bluetooth: hci_bcm: enable IRQ capability from node
  2019-12-11  9:49 [PATCH v3] bluetooth: hci_bcm: enable IRQ capability from node Guillaume La Roque
  2019-12-11 10:18 ` Marcel Holtmann
@ 2019-12-12 17:28 ` Nicolas Saenz Julienne
  2019-12-12 20:46   ` Marcel Holtmann
  1 sibling, 1 reply; 7+ messages in thread
From: Nicolas Saenz Julienne @ 2019-12-12 17:28 UTC (permalink / raw)
  To: Guillaume La Roque, marcel, johan.hedberg, linux-bluetooth
  Cc: linux-kernel, khilman, linux-rpi-kernel

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

On Wed, 2019-12-11 at 10:49 +0100, Guillaume La Roque wrote:
> Actually IRQ can be found from GPIO but all platforms don't support
> gpiod_to_irq, it's the case on amlogic chip.
> so to have possibility to use interrupt mode we need to add interrupts
> field in node and support it in driver.
> 
> Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
> ---
>  drivers/bluetooth/hci_bcm.c | 3 +++
>  1 file changed, 3 insertions(+)

This triggers the following panic on Raspberry Pi 4:

[    6.634507] Unable to handle kernel NULL pointer dereference at virtual
address 0000000000000018
[    6.643486] Mem abort info:
[    6.646350]   ESR = 0x96000004
[    6.649466]   EC = 0x25: DABT (current EL), IL = 32 bits
[    6.654873]   SET = 0, FnV = 0
[    6.657977]   EA = 0, S1PTW = 0
[    6.661201] Data abort info:
[    6.664135]   ISV = 0, ISS = 0x00000004
[    6.668042]   CM = 0, WnR = 0
[    6.671061] user pgtable: 4k pages, 48-bit VAs, pgdp=00000000f3c83000
[    6.677627] [0000000000000018] pgd=0000000000000000
[    6.682595] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[    6.688255] Modules linked in: hci_uart brcmutil btqca btbcm cfg80211
bluetooth raspberrypi_cpufreq ecdh_generic ecc rfkill clk_raspberrypi
raspberrypi_hwmon pwm_bcm2835 crct10dif_ce bcm2835_dma i2c_bcm2835 pcie_brcmstb
ip_tables x_tables ipv6 nf_defrag_ipv6
[    6.711519] CPU: 3 PID: 39 Comm: kworker/u8:1 Not tainted 5.5.0-rc1-next-
20191212-00009-geb500fec1e34-dirty #26
[    6.721771] Hardware name: Raspberry Pi 4 Model B Rev 1.1 (DT)
[    6.727709] Workqueue: events_unbound async_run_entry_fn
[    6.733105] pstate: a0000005 (NzCv daif -PAN -UAO)
[    6.737971] pc : platform_get_irq_optional+0xa4/0x260
[    6.743099] lr : platform_get_irq_optional+0x6c/0x260
[    6.748226] sp : ffff8000101b3c20
[    6.751586] x29: ffff8000101b3c20 x28: ffffd4bd4a957000
[    6.756980] x27: ffff0000f6c0c070 x26: ffff0000f6c0c020
[    6.762373] x25: 0000000000000000 x24: 0000000000000000
[    6.767767] x23: ffff0000f6238c00 x22: ffffd4bd4a241a38
[    6.773159] x21: ffffd4bd49e95838 x20: ffff0000f6238bf0
[    6.778552] x19: 0000000000000000 x18: 0000000000000010
[    6.783944] x17: 0000000000000000 x16: ffffd4bd497117a8
[    6.789337] x15: ffff0000f6fc0470 x14: 0720072007200720
[    6.794730] x13: 0720072007200720 x12: 0720072007200720
[    6.800123] x11: 0720072007200720 x10: 0720072007200720
[    6.805516] x9 : 0720072007200720 x8 : 0720072007200720
[    6.810913] x7 : ffffd4bd496ad210 x6 : 000000000000017d
[    6.810922] x5 : 0000000000000000 x4 : ffff0000fb7fa1b0
[    6.821713] x3 : 00000000f6238800 x2 : 0000000000000000
[    6.821716] x1 : 0000000000000000 x0 : 0000000000000000
[    6.821720] Call trace:
[    6.821730]  platform_get_irq_optional+0xa4/0x260
[    6.839768]  platform_get_irq+0x1c/0x58
[    6.839792]  bcm_serdev_probe+0x40/0x138 [hci_uart]
[    6.839805]  serdev_drv_probe+0x34/0x70
[    6.852544]  really_probe+0xd8/0x428
[    6.852546]  driver_probe_device+0xdc/0x130
[    6.852549]  __driver_attach_async_helper+0xa8/0xb0
[    6.852558]  async_run_entry_fn+0x40/0x1a0
[    6.869534]  process_one_work+0x19c/0x320
[    6.869537]  worker_thread+0x48/0x420
[    6.877319]  kthread+0xf0/0x120
[    6.877324]  ret_from_fork+0x10/0x18
[    6.877330] Code: 17ffffef f9419293 937a7c02 8b020273 (f9400e62)
[    6.890329] ---[ end trace 3ebb39e57973e0b7 ]---

> 
> diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
> index f8f5c593a05c..9f52d57c56de 100644
> --- a/drivers/bluetooth/hci_bcm.c
> +++ b/drivers/bluetooth/hci_bcm.c
> @@ -1409,6 +1409,7 @@ static int bcm_serdev_probe(struct serdev_device
> *serdev)
>  {
>  	struct bcm_device *bcmdev;
>  	const struct bcm_device_data *data;
> +	struct platform_device *pdev;
>  	int err;
>  
>  	bcmdev = devm_kzalloc(&serdev->dev, sizeof(*bcmdev), GFP_KERNEL);
> @@ -1421,6 +1422,8 @@ static int bcm_serdev_probe(struct serdev_device
> *serdev)
>  #endif
>  	bcmdev->serdev_hu.serdev = serdev;
>  	serdev_device_set_drvdata(serdev, bcmdev);
> +	pdev = to_platform_device(bcmdev->dev);

Ultimately bcmdev->dev here comes from a serdev device not a platform device,
right?

> +	bcmdev->irq = platform_get_irq(pdev, 0);
>  
>  	/* Initialize routing field to an unused value */
>  	bcmdev->pcm_int_params[0] = 0xff;

Regards,
Nicolas


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v3] bluetooth: hci_bcm: enable IRQ capability from node
  2019-12-12 17:28 ` Nicolas Saenz Julienne
@ 2019-12-12 20:46   ` Marcel Holtmann
  2019-12-12 22:29     ` guillaume La Roque
  2019-12-13  9:18     ` Johan Hovold
  0 siblings, 2 replies; 7+ messages in thread
From: Marcel Holtmann @ 2019-12-12 20:46 UTC (permalink / raw)
  To: Nicolas Saenz Julienne
  Cc: Guillaume La Roque, Johan Hedberg, BlueZ, lkml, khilman,
	linux-rpi-kernel

Hi Nicolas,

>> Actually IRQ can be found from GPIO but all platforms don't support
>> gpiod_to_irq, it's the case on amlogic chip.
>> so to have possibility to use interrupt mode we need to add interrupts
>> field in node and support it in driver.
>> 
>> Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
>> ---
>> drivers/bluetooth/hci_bcm.c | 3 +++
>> 1 file changed, 3 insertions(+)
> 
> This triggers the following panic on Raspberry Pi 4:
> 
> [    6.634507] Unable to handle kernel NULL pointer dereference at virtual
> address 0000000000000018
> [    6.643486] Mem abort info:
> [    6.646350]   ESR = 0x96000004
> [    6.649466]   EC = 0x25: DABT (current EL), IL = 32 bits
> [    6.654873]   SET = 0, FnV = 0
> [    6.657977]   EA = 0, S1PTW = 0
> [    6.661201] Data abort info:
> [    6.664135]   ISV = 0, ISS = 0x00000004
> [    6.668042]   CM = 0, WnR = 0
> [    6.671061] user pgtable: 4k pages, 48-bit VAs, pgdp=00000000f3c83000
> [    6.677627] [0000000000000018] pgd=0000000000000000
> [    6.682595] Internal error: Oops: 96000004 [#1] PREEMPT SMP
> [    6.688255] Modules linked in: hci_uart brcmutil btqca btbcm cfg80211
> bluetooth raspberrypi_cpufreq ecdh_generic ecc rfkill clk_raspberrypi
> raspberrypi_hwmon pwm_bcm2835 crct10dif_ce bcm2835_dma i2c_bcm2835 pcie_brcmstb
> ip_tables x_tables ipv6 nf_defrag_ipv6
> [    6.711519] CPU: 3 PID: 39 Comm: kworker/u8:1 Not tainted 5.5.0-rc1-next-
> 20191212-00009-geb500fec1e34-dirty #26
> [    6.721771] Hardware name: Raspberry Pi 4 Model B Rev 1.1 (DT)
> [    6.727709] Workqueue: events_unbound async_run_entry_fn
> [    6.733105] pstate: a0000005 (NzCv daif -PAN -UAO)
> [    6.737971] pc : platform_get_irq_optional+0xa4/0x260
> [    6.743099] lr : platform_get_irq_optional+0x6c/0x260
> [    6.748226] sp : ffff8000101b3c20
> [    6.751586] x29: ffff8000101b3c20 x28: ffffd4bd4a957000
> [    6.756980] x27: ffff0000f6c0c070 x26: ffff0000f6c0c020
> [    6.762373] x25: 0000000000000000 x24: 0000000000000000
> [    6.767767] x23: ffff0000f6238c00 x22: ffffd4bd4a241a38
> [    6.773159] x21: ffffd4bd49e95838 x20: ffff0000f6238bf0
> [    6.778552] x19: 0000000000000000 x18: 0000000000000010
> [    6.783944] x17: 0000000000000000 x16: ffffd4bd497117a8
> [    6.789337] x15: ffff0000f6fc0470 x14: 0720072007200720
> [    6.794730] x13: 0720072007200720 x12: 0720072007200720
> [    6.800123] x11: 0720072007200720 x10: 0720072007200720
> [    6.805516] x9 : 0720072007200720 x8 : 0720072007200720
> [    6.810913] x7 : ffffd4bd496ad210 x6 : 000000000000017d
> [    6.810922] x5 : 0000000000000000 x4 : ffff0000fb7fa1b0
> [    6.821713] x3 : 00000000f6238800 x2 : 0000000000000000
> [    6.821716] x1 : 0000000000000000 x0 : 0000000000000000
> [    6.821720] Call trace:
> [    6.821730]  platform_get_irq_optional+0xa4/0x260
> [    6.839768]  platform_get_irq+0x1c/0x58
> [    6.839792]  bcm_serdev_probe+0x40/0x138 [hci_uart]
> [    6.839805]  serdev_drv_probe+0x34/0x70
> [    6.852544]  really_probe+0xd8/0x428
> [    6.852546]  driver_probe_device+0xdc/0x130
> [    6.852549]  __driver_attach_async_helper+0xa8/0xb0
> [    6.852558]  async_run_entry_fn+0x40/0x1a0
> [    6.869534]  process_one_work+0x19c/0x320
> [    6.869537]  worker_thread+0x48/0x420
> [    6.877319]  kthread+0xf0/0x120
> [    6.877324]  ret_from_fork+0x10/0x18
> [    6.877330] Code: 17ffffef f9419293 937a7c02 8b020273 (f9400e62)
> [    6.890329] ---[ end trace 3ebb39e57973e0b7 ]---
> 
>> 
>> diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
>> index f8f5c593a05c..9f52d57c56de 100644
>> --- a/drivers/bluetooth/hci_bcm.c
>> +++ b/drivers/bluetooth/hci_bcm.c
>> @@ -1409,6 +1409,7 @@ static int bcm_serdev_probe(struct serdev_device
>> *serdev)
>> {
>> 	struct bcm_device *bcmdev;
>> 	const struct bcm_device_data *data;
>> +	struct platform_device *pdev;
>> 	int err;
>> 
>> 	bcmdev = devm_kzalloc(&serdev->dev, sizeof(*bcmdev), GFP_KERNEL);
>> @@ -1421,6 +1422,8 @@ static int bcm_serdev_probe(struct serdev_device
>> *serdev)
>> #endif
>> 	bcmdev->serdev_hu.serdev = serdev;
>> 	serdev_device_set_drvdata(serdev, bcmdev);
>> +	pdev = to_platform_device(bcmdev->dev);
> 
> Ultimately bcmdev->dev here comes from a serdev device not a platform device,
> right?

I was afraid of this, but then nobody spoke up. Can we fix this or should I just revert the patch?

Regards

Marcel


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

* Re: [PATCH v3] bluetooth: hci_bcm: enable IRQ capability from node
  2019-12-12 20:46   ` Marcel Holtmann
@ 2019-12-12 22:29     ` guillaume La Roque
  2019-12-13  7:56       ` Nicolas Saenz Julienne
  2019-12-13  9:18     ` Johan Hovold
  1 sibling, 1 reply; 7+ messages in thread
From: guillaume La Roque @ 2019-12-12 22:29 UTC (permalink / raw)
  To: Marcel Holtmann, Nicolas Saenz Julienne
  Cc: Johan Hedberg, BlueZ, lkml, khilman, linux-rpi-kernel

Hi Nicolas and Marcel,

On 12/12/19 9:46 PM, Marcel Holtmann wrote:
> Hi Nicolas,
>
>>> Actually IRQ can be found from GPIO but all platforms don't support
>>> gpiod_to_irq, it's the case on amlogic chip.
>>> so to have possibility to use interrupt mode we need to add interrupts
>>> field in node and support it in driver.
>>>
>>> Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
>>> ---
>>> drivers/bluetooth/hci_bcm.c | 3 +++
>>> 1 file changed, 3 insertions(+)
>> This triggers the following panic on Raspberry Pi 4:
>>
>> [    6.634507] Unable to handle kernel NULL pointer dereference at virtual
>> address 0000000000000018
>> [    6.643486] Mem abort info:
>> [    6.646350]   ESR = 0x96000004
>> [    6.649466]   EC = 0x25: DABT (current EL), IL = 32 bits
>> [    6.654873]   SET = 0, FnV = 0
>> [    6.657977]   EA = 0, S1PTW = 0
>> [    6.661201] Data abort info:
>> [    6.664135]   ISV = 0, ISS = 0x00000004
>> [    6.668042]   CM = 0, WnR = 0
>> [    6.671061] user pgtable: 4k pages, 48-bit VAs, pgdp=00000000f3c83000
>> [    6.677627] [0000000000000018] pgd=0000000000000000
>> [    6.682595] Internal error: Oops: 96000004 [#1] PREEMPT SMP
>> [    6.688255] Modules linked in: hci_uart brcmutil btqca btbcm cfg80211
>> bluetooth raspberrypi_cpufreq ecdh_generic ecc rfkill clk_raspberrypi
>> raspberrypi_hwmon pwm_bcm2835 crct10dif_ce bcm2835_dma i2c_bcm2835 pcie_brcmstb
>> ip_tables x_tables ipv6 nf_defrag_ipv6
>> [    6.711519] CPU: 3 PID: 39 Comm: kworker/u8:1 Not tainted 5.5.0-rc1-next-
>> 20191212-00009-geb500fec1e34-dirty #26
>> [    6.721771] Hardware name: Raspberry Pi 4 Model B Rev 1.1 (DT)
>> [    6.727709] Workqueue: events_unbound async_run_entry_fn
>> [    6.733105] pstate: a0000005 (NzCv daif -PAN -UAO)
>> [    6.737971] pc : platform_get_irq_optional+0xa4/0x260
>> [    6.743099] lr : platform_get_irq_optional+0x6c/0x260
>> [    6.748226] sp : ffff8000101b3c20
>> [    6.751586] x29: ffff8000101b3c20 x28: ffffd4bd4a957000
>> [    6.756980] x27: ffff0000f6c0c070 x26: ffff0000f6c0c020
>> [    6.762373] x25: 0000000000000000 x24: 0000000000000000
>> [    6.767767] x23: ffff0000f6238c00 x22: ffffd4bd4a241a38
>> [    6.773159] x21: ffffd4bd49e95838 x20: ffff0000f6238bf0
>> [    6.778552] x19: 0000000000000000 x18: 0000000000000010
>> [    6.783944] x17: 0000000000000000 x16: ffffd4bd497117a8
>> [    6.789337] x15: ffff0000f6fc0470 x14: 0720072007200720
>> [    6.794730] x13: 0720072007200720 x12: 0720072007200720
>> [    6.800123] x11: 0720072007200720 x10: 0720072007200720
>> [    6.805516] x9 : 0720072007200720 x8 : 0720072007200720
>> [    6.810913] x7 : ffffd4bd496ad210 x6 : 000000000000017d
>> [    6.810922] x5 : 0000000000000000 x4 : ffff0000fb7fa1b0
>> [    6.821713] x3 : 00000000f6238800 x2 : 0000000000000000
>> [    6.821716] x1 : 0000000000000000 x0 : 0000000000000000
>> [    6.821720] Call trace:
>> [    6.821730]  platform_get_irq_optional+0xa4/0x260
>> [    6.839768]  platform_get_irq+0x1c/0x58
>> [    6.839792]  bcm_serdev_probe+0x40/0x138 [hci_uart]
>> [    6.839805]  serdev_drv_probe+0x34/0x70
>> [    6.852544]  really_probe+0xd8/0x428
>> [    6.852546]  driver_probe_device+0xdc/0x130
>> [    6.852549]  __driver_attach_async_helper+0xa8/0xb0
>> [    6.852558]  async_run_entry_fn+0x40/0x1a0
>> [    6.869534]  process_one_work+0x19c/0x320
>> [    6.869537]  worker_thread+0x48/0x420
>> [    6.877319]  kthread+0xf0/0x120
>> [    6.877324]  ret_from_fork+0x10/0x18
>> [    6.877330] Code: 17ffffef f9419293 937a7c02 8b020273 (f9400e62)
>> [    6.890329] ---[ end trace 3ebb39e57973e0b7 ]---
>>
>>> diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
>>> index f8f5c593a05c..9f52d57c56de 100644
>>> --- a/drivers/bluetooth/hci_bcm.c
>>> +++ b/drivers/bluetooth/hci_bcm.c
>>> @@ -1409,6 +1409,7 @@ static int bcm_serdev_probe(struct serdev_device
>>> *serdev)
>>> {
>>> 	struct bcm_device *bcmdev;
>>> 	const struct bcm_device_data *data;
>>> +	struct platform_device *pdev;
>>> 	int err;
>>>
>>> 	bcmdev = devm_kzalloc(&serdev->dev, sizeof(*bcmdev), GFP_KERNEL);
>>> @@ -1421,6 +1422,8 @@ static int bcm_serdev_probe(struct serdev_device
>>> *serdev)
>>> #endif
>>> 	bcmdev->serdev_hu.serdev = serdev;
>>> 	serdev_device_set_drvdata(serdev, bcmdev);
>>> +	pdev = to_platform_device(bcmdev->dev);
>> Ultimately bcmdev->dev here comes from a serdev device not a platform device,
>> right?
> I was afraid of this, but then nobody spoke up. Can we fix this or should I just revert the patch?

sorry about that, i will provide a fix as soon as possible but i have no pi4 to validate on it so i will add no in cc nicolas and if you can give me a feedback i will appreciate .


Marcel, what is better for you a fix on this patch or a new version of this patch ?

> Regards
>
> Marcel
>
Regards

Guillaume


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

* Re: [PATCH v3] bluetooth: hci_bcm: enable IRQ capability from node
  2019-12-12 22:29     ` guillaume La Roque
@ 2019-12-13  7:56       ` Nicolas Saenz Julienne
  0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Saenz Julienne @ 2019-12-13  7:56 UTC (permalink / raw)
  To: guillaume La Roque, Marcel Holtmann
  Cc: Johan Hedberg, BlueZ, lkml, khilman, linux-rpi-kernel

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

> > > > diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
> > > > index f8f5c593a05c..9f52d57c56de 100644
> > > > --- a/drivers/bluetooth/hci_bcm.c
> > > > +++ b/drivers/bluetooth/hci_bcm.c
> > > > @@ -1409,6 +1409,7 @@ static int bcm_serdev_probe(struct serdev_device
> > > > *serdev)
> > > > {
> > > > 	struct bcm_device *bcmdev;
> > > > 	const struct bcm_device_data *data;
> > > > +	struct platform_device *pdev;
> > > > 	int err;
> > > > 
> > > > 	bcmdev = devm_kzalloc(&serdev->dev, sizeof(*bcmdev),
> > > > GFP_KERNEL);
> > > > @@ -1421,6 +1422,8 @@ static int bcm_serdev_probe(struct serdev_device
> > > > *serdev)
> > > > #endif
> > > > 	bcmdev->serdev_hu.serdev = serdev;
> > > > 	serdev_device_set_drvdata(serdev, bcmdev);
> > > > +	pdev = to_platform_device(bcmdev->dev);
> > > Ultimately bcmdev->dev here comes from a serdev device not a platform
> > > device,
> > > right?
> > I was afraid of this, but then nobody spoke up. Can we fix this or should I
> > just revert the patch?
> 
> sorry about that, i will provide a fix as soon as possible but i have no pi4
> to validate on it so i will add no in cc nicolas and if you can give me a
> feedback i will appreciate .

Thanks, I will :)

Regards,
Nicolas


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v3] bluetooth: hci_bcm: enable IRQ capability from node
  2019-12-12 20:46   ` Marcel Holtmann
  2019-12-12 22:29     ` guillaume La Roque
@ 2019-12-13  9:18     ` Johan Hovold
  1 sibling, 0 replies; 7+ messages in thread
From: Johan Hovold @ 2019-12-13  9:18 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Nicolas Saenz Julienne, Guillaume La Roque, Johan Hedberg, BlueZ,
	lkml, khilman, linux-rpi-kernel

On Thu, Dec 12, 2019 at 09:46:32PM +0100, Marcel Holtmann wrote:
> Hi Nicolas,
> 
> >> Actually IRQ can be found from GPIO but all platforms don't support
> >> gpiod_to_irq, it's the case on amlogic chip.
> >> so to have possibility to use interrupt mode we need to add interrupts
> >> field in node and support it in driver.
> >> 
> >> Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
> >> ---
> >> drivers/bluetooth/hci_bcm.c | 3 +++
> >> 1 file changed, 3 insertions(+)
> > 
> > This triggers the following panic on Raspberry Pi 4:
> > 
> > [    6.634507] Unable to handle kernel NULL pointer dereference at virtual
> > address 0000000000000018

> >> diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
> >> index f8f5c593a05c..9f52d57c56de 100644
> >> --- a/drivers/bluetooth/hci_bcm.c
> >> +++ b/drivers/bluetooth/hci_bcm.c
> >> @@ -1409,6 +1409,7 @@ static int bcm_serdev_probe(struct serdev_device
> >> *serdev)
> >> {
> >> 	struct bcm_device *bcmdev;
> >> 	const struct bcm_device_data *data;
> >> +	struct platform_device *pdev;
> >> 	int err;
> >> 
> >> 	bcmdev = devm_kzalloc(&serdev->dev, sizeof(*bcmdev), GFP_KERNEL);
> >> @@ -1421,6 +1422,8 @@ static int bcm_serdev_probe(struct serdev_device
> >> *serdev)
> >> #endif
> >> 	bcmdev->serdev_hu.serdev = serdev;
> >> 	serdev_device_set_drvdata(serdev, bcmdev);
> >> +	pdev = to_platform_device(bcmdev->dev);
> > 
> > Ultimately bcmdev->dev here comes from a serdev device not a platform device,
> > right?
> 
> I was afraid of this, but then nobody spoke up. Can we fix this or
> should I just revert the patch?

Just revert it, the patch is plain broken and makes no sense.

As Nicolas pointed out, bcmdev->dev is a member of struct serdev_device
so cannot be cast to a platform device.

Johan

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

end of thread, other threads:[~2019-12-13  9:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-11  9:49 [PATCH v3] bluetooth: hci_bcm: enable IRQ capability from node Guillaume La Roque
2019-12-11 10:18 ` Marcel Holtmann
2019-12-12 17:28 ` Nicolas Saenz Julienne
2019-12-12 20:46   ` Marcel Holtmann
2019-12-12 22:29     ` guillaume La Roque
2019-12-13  7:56       ` Nicolas Saenz Julienne
2019-12-13  9:18     ` Johan Hovold

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).