Make fwnode_property_get_reference_args accept NULL args
Subsystems (3)
Sakari Ailus
reviewerv4 cover Make fwnode_property_get_reference_args accept NULL args
Hi all,
The of_parse_phandle_with_args() accepts NULL args but fwnode_property_get_reference_args() does not currently, in its ACPI or software node implementations. Fix this.
since v3:
- Return 0 early if args is NULL (1st patch).
since v2:
- Correct fwnode_property_get_reference_args() name (was fwnode_property_get_reference()) in commit messages.
since v1:
- Applies to Rafael's devprop branch now (i.e. not on top of DisCo for Imaging set).
- Add Fixes: tags.
- Small documentation line wrap change in the first patch.
Sakari Ailus (3):
acpi: property: Let args be NULL in __acpi_node_get_property_reference software node: Let args be NULL in software_node_get_reference_args device property: fwnode_property_get_reference_args allows NULL args
now
drivers/acpi/property.c | 4 ++++ drivers/base/property.c | 1 + drivers/base/swnode.c | 3 +++ 3 files changed, 8 insertions(+)
Signature · 1 line
2.39.2
Sakari Ailus
reviewerPATCH v4 1/3 acpi: property: Let args be NULL in __acpi_node_get_property_reference
fwnode_get_property_reference_args() may not be called with args argument NULL on ACPI, OF already supports this. Add the missing NULL checks and document this.
The purpose is to be able to count the references.
--- drivers/acpi/property.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/acpi/property.c +4 -0
@@ -851,6 +851,7 @@ static int acpi_get_ref_args(struct fwnode_reference_args *args,* @index: Index of the reference to return * @num_args: Maximum number of arguments after each reference * @args: Location to store the returned reference with optional arguments +* (may be NULL) * * Find property with @name, verifify that it is a package containing at least * one object reference and if so, store the ACPI device object pointer to the
@@ -907,6 +908,9 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,if (!device)return -EINVAL ; +if (!args) +return 0 ; + args->fwnode =acpi_fwnode_handle (device); args->nargs =0 ;return 0 ;
Signature · 1 line
2.39.2
Re: [PATCH v4 1/3] acpi: property: Let args be NULL in __acpi_node_get_property_reference
Quoted 8 lines · Sakari Ailus
fwnode_get_property_reference_args()may not be called with args argument NULL on ACPI, OF already supports this. Add the missing NULL checks and document this.The purpose is to be able to count the references.
Fixes 977d5ad39f3e ("ACPI: Convert ACPI reference args to generic fwnode reference args")Signed-off-by Sakari Ailus <[email protected]>
Quoted 28 lines
--- drivers/acpi/property.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/acpi/property.c +4
-0@@ -851,6 +851,7 @@ static int acpi_get_ref_args(struct fwnode_reference_args *args,* @index: Index of the reference to return * @num_args: Maximum number of arguments after each reference * @args: Location to store the returned reference with optional arguments +* (may be NULL) * * Find property with @name, verifify that it is a package containing at least * one object reference and if so, store the ACPI device object pointer to the @@ -907,6 +908,9 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,if (!device)return -EINVAL ; +if (!args) +return 0 ; + args->fwnode =acpi_fwnode_handle (device); args->nargs =0 ;return 0 ;Signature · 1 line
2.39.2
Signature · 1 line
heikki
Rafael J. Wysocki
maintainerRe: [PATCH v4 1/3] acpi: property: Let args be NULL in __acpi_node_get_property_reference
In reply to Sakari AilusQuoted 26 lines · Sakari Ailus
fwnode_get_property_reference_args()may not be called with args argument NULL on ACPI, OF already supports this. Add the missing NULL checks and document this.The purpose is to be able to count the references.
Fixes 977d5ad39f3e ("ACPI: Convert ACPI reference args to generic fwnode reference args")Signed-off-by Sakari Ailus <[email protected]>--- drivers/acpi/property.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/acpi/property.c +1
-0@@ -851,6 +851,7 @@ static int acpi_get_ref_args(struct fwnode_reference_args *args,* @index: Index of the reference to return * @num_args: Maximum number of arguments after each reference * @args: Location to store the returned reference with optional arguments +* (may be NULL) * * Find property with @name, verifify that it is a package containing at least * one object reference and if so, store the ACPI device object pointer to the
drivers/acpi/property.c int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
Quoted 10 lines
drivers/acpi/property.c +3
-1@@ -907,6 +908,9 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,if (!device)return -EINVAL ; +if (!args) +return 0 ; + args->fwnode =acpi_fwnode_handle (device); args->nargs =0 ;return 0 ; --
Is this series waiting for me to pick it up or am I confused?
Sakari Ailus
reviewerRe: [PATCH v4 1/3] acpi: property: Let args be NULL in __acpi_node_get_property_reference
Quoted 31 lines · Rafael J. Wysocki
Quoted 29 lines · Sakari Ailus
fwnode_get_property_reference_args()may not be called with args argument NULL on ACPI, OF already supports this. Add the missing NULL checks and document this.The purpose is to be able to count the references.
Fixes 977d5ad39f3e ("ACPI: Convert ACPI reference args to generic fwnode reference args")Signed-off-by Sakari Ailus <[email protected]>--- drivers/acpi/property.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/acpi/property.c +1
-0@@ -851,6 +851,7 @@ static int acpi_get_ref_args(struct fwnode_reference_args *args,* @index: Index of the reference to return * @num_args: Maximum number of arguments after each reference * @args: Location to store the returned reference with optional arguments +* (may be NULL) * * Find property with @name, verifify that it is a package containing at least * one object reference and if so, store the ACPI device object pointer to the @@ -907,6 +908,9 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,if (!device)return -EINVAL ;
Quoted 9 lines
drivers/acpi/property.c int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
Quoted 7 lines
drivers/acpi/property.c +3
-1+if (!args) +return 0 ; + args->fwnode =acpi_fwnode_handle (device); args->nargs =0 ;return 0 ; --Is this series waiting for me to pick it up or am I confused?
Yes, please!
Signature · 1 line
Sakari Ailus
Rafael J. Wysocki
maintainerRe: [PATCH v4 1/3] acpi: property: Let args be NULL in __acpi_node_get_property_reference
Quoted 43 lines · Sakari Ailus
Quoted 31 lines · Rafael J. Wysocki
Quoted 29 lines · Sakari Ailus
fwnode_get_property_reference_args()may not be called with args argument NULL on ACPI, OF already supports this. Add the missing NULL checks and document this.The purpose is to be able to count the references.
Fixes 977d5ad39f3e ("ACPI: Convert ACPI reference args to generic fwnode reference args")Signed-off-by Sakari Ailus <[email protected]>--- drivers/acpi/property.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/acpi/property.c +1
-0@@ -851,6 +851,7 @@ static int acpi_get_ref_args(struct fwnode_reference_args *args,* @index: Index of the reference to return * @num_args: Maximum number of arguments after each reference * @args: Location to store the returned reference with optional arguments +* (may be NULL) * * Find property with @name, verifify that it is a package containing at least * one object reference and if so, store the ACPI device object pointer to the @@ -907,6 +908,9 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,if (!device)return -EINVAL ;Quoted 9 lines
drivers/acpi/property.c int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
Quoted 7 lines
drivers/acpi/property.c +3
-1+if (!args) +return 0 ; + args->fwnode =acpi_fwnode_handle (device); args->nargs =0 ;return 0 ; --Is this series waiting for me to pick it up or am I confused?
Quoted 1 line
Yes, please!
OK, applied as 6.8 material, thanks!
Sakari Ailus
reviewerRe: [PATCH v4 1/3] acpi: property: Let args be NULL in __acpi_node_get_property_reference
Quoted 45 lines · Rafael J. Wysocki
Quoted 43 lines · Sakari Ailus
Quoted 40 lines · Rafael J. Wysocki
Quoted 26 lines · Sakari Ailus
fwnode_get_property_reference_args()may not be called with args argument NULL on ACPI, OF already supports this. Add the missing NULL checks and document this.The purpose is to be able to count the references.
Fixes 977d5ad39f3e ("ACPI: Convert ACPI reference args to generic fwnode reference args")Signed-off-by Sakari Ailus <[email protected]>--- drivers/acpi/property.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/acpi/property.c +1
-0@@ -851,6 +851,7 @@ static int acpi_get_ref_args(struct fwnode_reference_args *args,* @index: Index of the reference to return * @num_args: Maximum number of arguments after each reference * @args: Location to store the returned reference with optional arguments +* (may be NULL) * * Find property with @name, verifify that it is a package containing at least * one object reference and if so, store the ACPI device object pointer to the drivers/acpi/property.c int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
Quoted 10 lines
drivers/acpi/property.c +3
-1@@ -907,6 +908,9 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,if (!device)return -EINVAL ; +if (!args) +return 0 ; + args->fwnode =acpi_fwnode_handle (device); args->nargs =0 ;return 0 ; --Is this series waiting for me to pick it up or am I confused?
Quoted 3 lines
Quoted 1 line
Yes, please!
OK, applied as 6.8 material, thanks!
Thank you, Rafael!
Signature · 1 line
Sakari Ailus
Sakari Ailus
reviewerPATCH v4 2/3 software node: Let args be NULL in software_node_get_reference_args
In reply to Sakari Ailusfwnode_get_property_reference_args() may not be called with args argument NULL and while OF already supports this. Add the missing NULL check.
The purpose is to be able to count the references.
--- drivers/base/swnode.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/base/swnode.c +3 -0
@@ -541,6 +541,9 @@ software_node_get_reference_args(const struct fwnode_handle *fwnode,if (nargs >NR_FWNODE_REFERENCE_ARGS )return -EINVAL ; +if (!args) +return 0 ; + args->fwnode =software_node_get (refnode); args->nargs = nargs;
Signature · 1 line
2.39.2
Re: [PATCH v4 2/3] software node: Let args be NULL in software_node_get_reference_args
Quoted 7 lines · Sakari Ailus
fwnode_get_property_reference_args()may not be called with args argument NULL and while OF already supports this. Add the missing NULL check.The purpose is to be able to count the references.
Fixes b06184acf751 ("software node: Add software_node_get_reference_args()")Signed-off-by Sakari Ailus <[email protected]>
Quoted 20 lines
--- drivers/base/swnode.c | 3 +++ 1 file changed, 3 insertions(+)drivers/base/swnode.c +3
-0@@ -541,6 +541,9 @@ software_node_get_reference_args(const struct fwnode_handle *fwnode,if (nargs >NR_FWNODE_REFERENCE_ARGS )return -EINVAL ; +if (!args) +return 0 ; + args->fwnode =software_node_get (refnode); args->nargs = nargs;Signature · 1 line
2.39.2
Signature · 1 line
heikki
Sakari Ailus
reviewerPATCH v4 3/3 device property: fwnode_property_get_reference_args allows NULL args now
In reply to Sakari AilusAll three fwnode_property_get_reference_args() implemantations now allow args argument to be NULL. Document this.
--- drivers/base/property.c | 1 + 1 file changed, 1 insertion(+)
drivers/base/property.c +1 -0
@@ -508,6 +508,7 @@ EXPORT_SYMBOL_GPL(fwnode_property_match_string);* @nargs: Number of arguments. Ignored if @nargs_prop is non-NULL. * @index: Index of the reference, from zero onwards. * @args: Result structure with reference and integer arguments. +* May be NULL. * * Obtain a reference based on a named property in an fwnode, with * integer arguments.
Signature · 1 line
2.39.2
Re: [PATCH v4 3/3] device property: fwnode_property_get_reference_args allows NULL args now
Quoted 4 lines · Sakari Ailus
All three
fwnode_property_get_reference_args()implemantations now allow args argument to be NULL. Document this.Signed-off-by Sakari Ailus <[email protected]>
Quoted 18 lines
--- drivers/base/property.c | 1 + 1 file changed, 1 insertion(+)drivers/base/property.c +1
-0@@ -508,6 +508,7 @@ EXPORT_SYMBOL_GPL(fwnode_property_match_string);* @nargs: Number of arguments. Ignored if @nargs_prop is non-NULL. * @index: Index of the reference, from zero onwards. * @args: Result structure with reference and integer arguments. +* May be NULL. * * Obtain a reference based on a named property in an fwnode, with * integer arguments. Signature · 1 line
2.39.2
Signature · 1 line
heikki