On Tue, Apr 16, 2019 at 7:06 AM Michal Simek <monstr@xxxxxxxxx> wrote: > > From the first look this is not proper implementation. It is not > handling cases where you have mix of devices with and without aliases. > If first mgr has no alias it gets 0, then second devices with fpga0 > alias can't take it even it is assign to it. >From what I can tell, most of the drivers that use of_alias_get_id() work this way. They assume the devicetree will either contain aliases for all devices, or none at all; and prints a dev_warn() if there's a mismatch. Not to say this is the best solution, but it's the precedent. > > For exactly this reason I have introduced of_alias_get_alias_list() > and take a look at cdns_get_id() in serial driver how I am using it. It looks like cdns_get_id() uses bitmaps instead of IDA to handle this, which complicates this. I'd prefer to not pull in those changes for now if that's ok with the maintainers. I could see value in adding an of.h helper like of_alias_ida_get() that handles the boiler plate stuff of requesting the alias ID and searching for a valid ID, though. > > Thanks, > Michal > > -- > Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 > w: www.monstr.eu p: +42-0-721842854 > Maintainer of Linux kernel - Xilinx Microblaze > Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs > U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs > > Thanks, Brandon