Re: [PATCH v5 3/3] Bluetooth: btqcomsmd: retieve BD address from DT
From: Rob Herring <robh+dt@kernel.org>
Date: 2017-09-07 15:50:32
Also in:
linux-arm-msm, linux-devicetree
On Wed, Sep 6, 2017 at 2:04 AM, Marcel Holtmann [off-list ref] wrote= :
Hi Rob,quoted
quoted
Retrieve BD address from the DT local-bd-address property. This address must be unique and is usually added in the DT by the bootloader which has access to the provisioned data. Signed-off-by: Loic Poulain <redacted>
[...]
quoted
quoted
+ /* The local-bd-address DT property is usually injected by the + * bootloader which has access to the allocated BD address. + */ + bdaddr =3D of_get_property(pdev->dev.of_node, "local-bd-address=
", &ret);
quoted
quoted
+ if (bdaddr && ret =3D=3D sizeof(bdaddr_t)) { + BT_INFO("BD address %pMR retrieved from device-tree", b=
daddr);
quoted
quoted
+ bacpy(&btq->bdaddr, bdaddr); + }Can we put all this into a helper function before we get more instances. And use the u8 array property function. We're trying to make of_get_property an internal function.using of_property_read_u8_array seems sensible since that would shorten t=
his into
if (!of_property_read_u8_array(pdev->dev.of_node, =E2=80=9Clocal-=bd-address=E2=80=9D, &btq->bdaddr, 6))
bt_dev_info(pdev->dev, =E2=80=9CBD address %pMR ..=E2=80=
=9D, &btq->bdaddr);
Yes.
Creating a Bluetooth internal helper function seems rather pointless at t=
his stage. If more users appears, then we might need to move this into the = Bluetooth core to deal with this. However as said before, I am not a big fa= n of IEEE address assignment via DT since that forces to have the smarts in= the boot loader and the boot loader doing the right thing. There are too m= any boards and DT where this will not be true. In a lot of cases it would m= ake more sense to store the BD address as part of your file system. Since w= e do support this in a total generic fashion, I rather push for that method= and have the QCOM SMD based SoC being the exception. Okay, sounds reasonable and it's your call anyway. Rob BTW, your mails are always quoted-printable encoding which shouldn't be used on lists AIUI.