Re: [PATCH v9 2/3] of: factor arguments passed to of_map_id() into a struct

From: Marc Zyngier

Date: Sun Mar 01 2026 - 06:46:11 EST


On Sun, 01 Mar 2026 10:59:23 +0000,
Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxxxxxxxx> wrote:
>
> On Sun, Mar 01, 2026 at 02:04:20PM +0530, Vijayanand Jitta wrote:
> > From: Charan Teja Kalla <charan.kalla@xxxxxxxxxxxxxxxx>
> >
> > Change of_map_id() to take a pointer to struct of_phandle_args
> > instead of passing target device node and translated IDs separately.
> > Update all callers accordingly.
> >
> > Subsequent patch will make use of the args_count field in
> > struct of_phandle_args.
> >
> > Suggested-by: Rob Herring (Arm) <robh@xxxxxxxxxx>
> > Signed-off-by: Charan Teja Kalla <charan.kalla@xxxxxxxxxxxxxxxx>
> > Signed-off-by: Vijayanand Jitta <vijayanand.jitta@xxxxxxxxxxxxxxxx>
> > ---
> > drivers/iommu/of_iommu.c | 2 +-
> > drivers/of/base.c | 37 +++++++++++++++++------------------
> > drivers/pci/controller/dwc/pci-imx6.c | 8 +++++++-
> > drivers/pci/controller/pcie-apple.c | 4 +++-
> > drivers/xen/grant-dma-ops.c | 2 +-
> > include/linux/of.h | 21 +++++++++++++-------
> > 6 files changed, 44 insertions(+), 30 deletions(-)
> >
> > diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c
> > index a0937b7b3c4d..e1d4b37d200d 100644
> > --- a/drivers/pci/controller/pcie-apple.c
> > +++ b/drivers/pci/controller/pcie-apple.c
> > @@ -755,6 +755,7 @@ static int apple_pcie_enable_device(struct pci_host_bridge *bridge, struct pci_d
> > {
> > u32 sid, rid = pci_dev_id(pdev);
> > struct apple_pcie_port *port;
> > + struct of_phandle_args iommu_spec = { .args_count = 1 };
>
> Hmm, I didn't notice this. Parsing functions are expected to ignore
> of_phandle_args before the parsing. So passing .args_count = 1 is
> strange.

It isn't strange. It is a semantic requirement. It explicitly
indicates the boundary of what the driver is prepared to receive, just
like passing a single u32 * is perfectly clear.

Frankly, this patch makes an absolute mess of the current API.

M.

--
Without deviation from the norm, progress is not possible.