All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Marcel Holtmann <marcel-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>
Cc: Loic Poulain
	<loic.poulain-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Johan Hedberg
	<johan.hedberg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"open list:BLUETOOTH DRIVERS"
	<linux-bluetooth-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-arm-msm
	<linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Bjorn Andersson
	<bjorn.andersson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH v5 3/3] Bluetooth: btqcomsmd: retieve BD address from DT
Date: Thu, 7 Sep 2017 10:50:32 -0500	[thread overview]
Message-ID: <CAL_JsqLVQeC9TX6g+JbYq6gX7LbRT_-oeTevwDMeX8VHRrEcXg@mail.gmail.com> (raw)
In-Reply-To: <46A7D7AE-FDBB-424D-8E85-7180FEE24A14-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>

On Wed, Sep 6, 2017 at 2:04 AM, Marcel Holtmann <marcel-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org> wrote:
> Hi Rob,
>
>>> 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 <loic.poulain-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

[...]

>>> +       /* The local-bd-address DT property is usually injected by the
>>> +        * bootloader which has access to the allocated BD address.
>>> +        */
>>> +       bdaddr = of_get_property(pdev->dev.of_node, "local-bd-address", &ret);
>>> +       if (bdaddr && ret == sizeof(bdaddr_t)) {
>>> +               BT_INFO("BD address %pMR retrieved from device-tree", bdaddr);
>>> +               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 this into
>
>         if (!of_property_read_u8_array(pdev->dev.of_node, “local-bd-address”, &btq->bdaddr, 6))
>                 bt_dev_info(pdev->dev, “BD address %pMR ..”, &btq->bdaddr);
>

Yes.

> Creating a Bluetooth internal helper function seems rather pointless at this 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 fan 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 many boards and DT where this will not be true. In a lot of cases it would make more sense to store the BD address as part of your file system. Since we 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.

WARNING: multiple messages have this Message-ID (diff)
From: Rob Herring <robh+dt@kernel.org>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: Loic Poulain <loic.poulain@linaro.org>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	"open list:BLUETOOTH DRIVERS" <linux-bluetooth@vger.kernel.org>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>
Subject: Re: [PATCH v5 3/3] Bluetooth: btqcomsmd: retieve BD address from DT
Date: Thu, 7 Sep 2017 10:50:32 -0500	[thread overview]
Message-ID: <CAL_JsqLVQeC9TX6g+JbYq6gX7LbRT_-oeTevwDMeX8VHRrEcXg@mail.gmail.com> (raw)
In-Reply-To: <46A7D7AE-FDBB-424D-8E85-7180FEE24A14@holtmann.org>

On Wed, Sep 6, 2017 at 2:04 AM, Marcel Holtmann <marcel@holtmann.org> wrote=
:
> Hi Rob,
>
>>> 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 <loic.poulain@linaro.org>

[...]

>>> +       /* 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);
>>> +       if (bdaddr && ret =3D=3D sizeof(bdaddr_t)) {
>>> +               BT_INFO("BD address %pMR retrieved from device-tree", b=
daddr);
>>> +               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.

  parent reply	other threads:[~2017-09-07 15:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-05 18:58 [PATCH v5 1/3] DT: net: document Bluetooth bindings in one place Loic Poulain
2017-09-05 18:58 ` Loic Poulain
2017-09-05 18:58 ` [PATCH v5 2/3] dt-bindings: soc: qcom: Add local-bd-address property to WCNSS-BT Loic Poulain
2017-09-13 16:21   ` Rob Herring
     [not found] ` <1504637923-21652-1-git-send-email-loic.poulain-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-09-05 18:58   ` [PATCH v5 3/3] Bluetooth: btqcomsmd: retieve BD address from DT Loic Poulain
2017-09-05 18:58     ` Loic Poulain
     [not found]     ` <1504637923-21652-3-git-send-email-loic.poulain-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-09-05 21:47       ` Rob Herring
2017-09-05 21:47         ` Rob Herring
     [not found]         ` <CAL_JsqJhEaZkcBA6qnC3rVduQJ9Yesrz_h9i_WXo1bRaq1NT4Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-09-06  7:04           ` Marcel Holtmann
2017-09-06  7:04             ` Marcel Holtmann
     [not found]             ` <46A7D7AE-FDBB-424D-8E85-7180FEE24A14-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>
2017-09-07 15:50               ` Rob Herring [this message]
2017-09-07 15:50                 ` Rob Herring
2017-09-13 16:21   ` [PATCH v5 1/3] DT: net: document Bluetooth bindings in one place Rob Herring
2017-09-13 16:21     ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAL_JsqLVQeC9TX6g+JbYq6gX7LbRT_-oeTevwDMeX8VHRrEcXg@mail.gmail.com \
    --to=robh+dt-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=bjorn.andersson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=johan.hedberg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-bluetooth-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=loic.poulain-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=marcel-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.