Re: [PATCH v3.1 1/2] device property: Add device_get_bd_address() and fwnode_get_bd_address()
From: Matthias Kaehlcke
Date: Thu Sep 27 2018 - 13:04:55 EST
On Thu, Sep 27, 2018 at 02:38:29PM +0300, Heikki Krogerus wrote:
> Hi Marcel,
>
> On Thu, Sep 27, 2018 at 12:24:33PM +0200, Marcel Holtmann wrote:
> > > Let's not fill property.c with framework specific helper functions any
> > > more!
> > >
> > > Those functions are completely bluetooth specific, so they do not
> > > belong here. The fact that some other framework already managed to
> > > slip their helpers in does not justify others to do the same.
> >
> > so? The firmware guys decided to put MAC addresses and BD addresses into the
> > firmware. So you have to deal with that.
>
> I think you have misunderstood the point.
>
> > Moving this into the Bluetooth subsystem is as pointless. I rather keep the
> > accessor function to firmware specific data in one place and not spread around
> > the whole tree. Especially once this is also provided via ACPI or some other
> > means. I assumed that is what the whole device_get part was suppose to
> > abstract.
>
> Unified device property API defines a _generic_ API that can be used
> by any type of device to access the device properties regardless of
> the way the hardware is described.
>
> Any device can use device_property_read_u8/u16/u32/u64/string()
> functions, but only bluetooth devices can use device_get_bd_address().
> Therefore that function does not belong to drivers/base/properties.c.
Initially property.[ch] seemed the correct place to me since the
device_get_bd_address() is the equivalent to
device_get_mac_address(), which lives there. However I doubted to use
bdaddr_t in the interface when I noticed that the other functions only
use generic data types. Not a red flag but a first hint that it's
probably not the right place for Bluetooth specific functions. I
agree with Heikki that the Bluetooth subsystem seems a better home for
this API.
Cheers
Matthias