Message ID | 20241008082721.4004100-1-wenst@chromium.org (mailing list archive) |
---|---|
State | Accepted |
Commit | cbb516bbcdfda2f0a409b88e5072ade98a1496ef |
Headers | show |
Series | [RESEND] Bluetooth: btmtksdio: Lookup device node only as fallback | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | success | Success |
tedd_an/CheckPatch | success | CheckPatch PASS |
tedd_an/GitLint | fail | WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search 18: B1 Line exceeds max length (88>80): "[1] https://lore.kernel.org/linux-bluetooth/20240412073046.1192744-1-wenst@chromium.org/" |
tedd_an/SubjectPrefix | success | Gitlint PASS |
tedd_an/BuildKernel | success | BuildKernel PASS |
tedd_an/CheckAllWarning | success | CheckAllWarning PASS |
tedd_an/CheckSparse | success | CheckSparse PASS |
Hi, On Tue, Oct 8, 2024 at 4:27 AM Chen-Yu Tsai <wenst@chromium.org> wrote: > > If the device tree is properly written, the SDIO function device node > should be correctly defined, and the mmc core in Linux should correctly > tie it to the device being probed. > > Only fall back to searching for the device node by compatible if the > original device node tied to the device is incorrect, as seen in older > device trees. > > Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> I was hoping to see some Reviewed-by/Tested-by here, were the mediatek made aware of these changes? > --- > Resending after three and a half months. > > This follows up on the MT7921S bluetooth binding and DT fixup patches [1]. > This should not be backported. > > [1] https://lore.kernel.org/linux-bluetooth/20240412073046.1192744-1-wenst@chromium.org/ > > drivers/bluetooth/btmtksdio.c | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) > > diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c > index cc097aedc1e1..a1dfcfe43d3a 100644 > --- a/drivers/bluetooth/btmtksdio.c > +++ b/drivers/bluetooth/btmtksdio.c > @@ -1328,6 +1328,8 @@ static int btmtksdio_probe(struct sdio_func *func, > { > struct btmtksdio_dev *bdev; > struct hci_dev *hdev; > + struct device_node *old_node; > + bool restore_node; > int err; > > bdev = devm_kzalloc(&func->dev, sizeof(*bdev), GFP_KERNEL); > @@ -1411,13 +1413,24 @@ static int btmtksdio_probe(struct sdio_func *func, > if (err) > bt_dev_err(hdev, "failed to initialize device wakeup"); > > - bdev->dev->of_node = of_find_compatible_node(NULL, NULL, > - "mediatek,mt7921s-bluetooth"); > + restore_node = false; > + if (!of_device_is_compatible(bdev->dev->of_node, "mediatek,mt7921s-bluetooth")) { > + restore_node = true; > + old_node = bdev->dev->of_node; > + bdev->dev->of_node = of_find_compatible_node(NULL, NULL, > + "mediatek,mt7921s-bluetooth"); > + } > + > bdev->reset = devm_gpiod_get_optional(bdev->dev, "reset", > GPIOD_OUT_LOW); > if (IS_ERR(bdev->reset)) > err = PTR_ERR(bdev->reset); > > + if (restore_node) { > + of_node_put(bdev->dev->of_node); > + bdev->dev->of_node = old_node; > + } > + > return err; > } > > -- > 2.47.0.rc0.187.ge670bccf7e-goog >
Il 08/10/24 15:39, Luiz Augusto von Dentz ha scritto: > Hi, > > On Tue, Oct 8, 2024 at 4:27 AM Chen-Yu Tsai <wenst@chromium.org> wrote: >> >> If the device tree is properly written, the SDIO function device node >> should be correctly defined, and the mmc core in Linux should correctly >> tie it to the device being probed. >> >> Only fall back to searching for the device node by compatible if the >> original device node tied to the device is incorrect, as seen in older >> device trees. >> >> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> > > I was hoping to see some Reviewed-by/Tested-by here, were the mediatek > made aware of these changes? > Sorry I didn't see this patch in my .. rather big .. stack of patches :-D I can confirm Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> # MT8186 Corsola Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Cheers, Angelo >> --- >> Resending after three and a half months. >> >> This follows up on the MT7921S bluetooth binding and DT fixup patches [1]. >> This should not be backported. >> >> [1] https://lore.kernel.org/linux-bluetooth/20240412073046.1192744-1-wenst@chromium.org/ >> >> drivers/bluetooth/btmtksdio.c | 17 +++++++++++++++-- >> 1 file changed, 15 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c >> index cc097aedc1e1..a1dfcfe43d3a 100644 >> --- a/drivers/bluetooth/btmtksdio.c >> +++ b/drivers/bluetooth/btmtksdio.c >> @@ -1328,6 +1328,8 @@ static int btmtksdio_probe(struct sdio_func *func, >> { >> struct btmtksdio_dev *bdev; >> struct hci_dev *hdev; >> + struct device_node *old_node; >> + bool restore_node; >> int err; >> >> bdev = devm_kzalloc(&func->dev, sizeof(*bdev), GFP_KERNEL); >> @@ -1411,13 +1413,24 @@ static int btmtksdio_probe(struct sdio_func *func, >> if (err) >> bt_dev_err(hdev, "failed to initialize device wakeup"); >> >> - bdev->dev->of_node = of_find_compatible_node(NULL, NULL, >> - "mediatek,mt7921s-bluetooth"); >> + restore_node = false; >> + if (!of_device_is_compatible(bdev->dev->of_node, "mediatek,mt7921s-bluetooth")) { >> + restore_node = true; >> + old_node = bdev->dev->of_node; >> + bdev->dev->of_node = of_find_compatible_node(NULL, NULL, >> + "mediatek,mt7921s-bluetooth"); >> + } >> + >> bdev->reset = devm_gpiod_get_optional(bdev->dev, "reset", >> GPIOD_OUT_LOW); >> if (IS_ERR(bdev->reset)) >> err = PTR_ERR(bdev->reset); >> >> + if (restore_node) { >> + of_node_put(bdev->dev->of_node); >> + bdev->dev->of_node = old_node; >> + } >> + >> return err; >> } >> >> -- >> 2.47.0.rc0.187.ge670bccf7e-goog >> > >
Hello: This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>: On Tue, 8 Oct 2024 16:27:20 +0800 you wrote: > If the device tree is properly written, the SDIO function device node > should be correctly defined, and the mmc core in Linux should correctly > tie it to the device being probed. > > Only fall back to searching for the device node by compatible if the > original device node tied to the device is incorrect, as seen in older > device trees. > > [...] Here is the summary with links: - [RESEND] Bluetooth: btmtksdio: Lookup device node only as fallback https://git.kernel.org/bluetooth/bluetooth-next/c/cbb516bbcdfd You are awesome, thank you!
diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c index cc097aedc1e1..a1dfcfe43d3a 100644 --- a/drivers/bluetooth/btmtksdio.c +++ b/drivers/bluetooth/btmtksdio.c @@ -1328,6 +1328,8 @@ static int btmtksdio_probe(struct sdio_func *func, { struct btmtksdio_dev *bdev; struct hci_dev *hdev; + struct device_node *old_node; + bool restore_node; int err; bdev = devm_kzalloc(&func->dev, sizeof(*bdev), GFP_KERNEL); @@ -1411,13 +1413,24 @@ static int btmtksdio_probe(struct sdio_func *func, if (err) bt_dev_err(hdev, "failed to initialize device wakeup"); - bdev->dev->of_node = of_find_compatible_node(NULL, NULL, - "mediatek,mt7921s-bluetooth"); + restore_node = false; + if (!of_device_is_compatible(bdev->dev->of_node, "mediatek,mt7921s-bluetooth")) { + restore_node = true; + old_node = bdev->dev->of_node; + bdev->dev->of_node = of_find_compatible_node(NULL, NULL, + "mediatek,mt7921s-bluetooth"); + } + bdev->reset = devm_gpiod_get_optional(bdev->dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(bdev->reset)) err = PTR_ERR(bdev->reset); + if (restore_node) { + of_node_put(bdev->dev->of_node); + bdev->dev->of_node = old_node; + } + return err; }
If the device tree is properly written, the SDIO function device node should be correctly defined, and the mmc core in Linux should correctly tie it to the device being probed. Only fall back to searching for the device node by compatible if the original device node tied to the device is incorrect, as seen in older device trees. Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> --- Resending after three and a half months. This follows up on the MT7921S bluetooth binding and DT fixup patches [1]. This should not be backported. [1] https://lore.kernel.org/linux-bluetooth/20240412073046.1192744-1-wenst@chromium.org/ drivers/bluetooth/btmtksdio.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)