Re: [PATCH 1/2] of/fdt: Remove dead code and mark functions with __init

From: Rob Herring
Date: Tue May 14 2019 - 13:08:48 EST


On Thu, May 9, 2019 at 4:55 PM Stephen Boyd <swboyd@xxxxxxxxxxxx> wrote:
>
> Some functions in here are never called, and others are only called
> during __init. Remove the dead code and some dead exports for functions
> that don't exist (I'm looking at you of_fdt_get_string!). Mark some
> functions with __init so we can throw them away after we boot up and
> poke at the FDT blob too.

Some of these aren't called, but there are cases where they could be
used instead of accessing initial_boot_params directly. The question
is what direction do we want to go. Make initial_boot_params private
or do away with the wrapper api and expect users to use libfdt api
only. I guess I lean toward the latter because that aligns with my
goal to move all the code in drivers/of/ somewhere else so I have
nothing to maintain. :)

>
> Cc: Hsin-Yi Wang <hsinyi@xxxxxxxxxxxx>
> Signed-off-by: Stephen Boyd <swboyd@xxxxxxxxxxxx>
> ---
> .../devicetree/bindings/common-properties.txt | 4 +-
> drivers/of/fdt.c | 37 +++----------------
> include/linux/of_fdt.h | 11 ------
> 3 files changed, 7 insertions(+), 45 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/common-properties.txt b/Documentation/devicetree/bindings/common-properties.txt
> index a3448bfa1c82..1c50d8700ab5 100644
> --- a/Documentation/devicetree/bindings/common-properties.txt
> +++ b/Documentation/devicetree/bindings/common-properties.txt
> @@ -25,8 +25,8 @@ Optional properties:
> If a binding supports these properties, then the binding should also
> specify the default behavior if none of these properties are present.
> In such cases, little-endian is the preferred default, but it is not
> -a requirement. The of_device_is_big_endian() and of_fdt_is_big_endian()
> -helper functions do assume that little-endian is the default, because
> +a requirement. The of_device_is_big_endian()

Hum, we shouldn't have kernel functions in binding docs. Can you
reword to remove both functions.

> +helper function assumes that little-endian is the default, because
> most existing (PCI-based) drivers implicitly default to LE by using
> readl/writel for MMIO accesses.
>