Re: [PATCH 2/8] of: Change of_device_get_modalias() main argument
From: Rob Herring
Date: Thu Mar 02 2023 - 14:38:14 EST
On Wed, Mar 1, 2023 at 9:22 AM Miquel Raynal <miquel.raynal@xxxxxxxxxxx> wrote:
>
> This function needs "struct device_node" to work, but for convenience
> the author and only user of this helper did use a "struct device". As
> this helper is a static helper, let's keep the "struct device" for
> exported methods and use the OF structure internally.
>
> Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
> ---
> drivers/of/device.c | 27 ++++++++++++++++-----------
> 1 file changed, 16 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/of/device.c b/drivers/of/device.c
> index 877f50379fab..3efc17de1d57 100644
> --- a/drivers/of/device.c
> +++ b/drivers/of/device.c
> @@ -248,7 +248,7 @@ const void *of_device_get_match_data(const struct device *dev)
> }
> EXPORT_SYMBOL(of_device_get_match_data);
>
> -static ssize_t of_device_get_modalias(struct device *dev, char *str, ssize_t len)
> +static ssize_t of_device_get_modalias(struct device_node *np, char *str, ssize_t len)
Humm, this is static so fine here, but based on my comments on patch
3, it would need to move too as base.c having a dependency on device.c
is backwards.
How about moving everything module related to drivers/of/module.c. Put
the new functions in of.h (rather than an of_module.h). Then maybe the
rest of device.c could move to inline wrappers or elsewhere.
Rob