[PATCH net-next v4 1/5] pldmfw: Don't require send_package_data or send_component_table to be defined

Lee Trager posted 5 patches 7 months, 1 week ago
There is a newer version of this series
[PATCH net-next v4 1/5] pldmfw: Don't require send_package_data or send_component_table to be defined
Posted by Lee Trager 7 months, 1 week ago
Not all drivers require send_package_data or send_component_table when
updating firmware. Instead of forcing drivers to implement a stub allow
these functions to go undefined.

Signed-off-by: Lee Trager <lee@trager.us>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 lib/pldmfw/pldmfw.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/pldmfw/pldmfw.c b/lib/pldmfw/pldmfw.c
index 6264e2013f25..b45ceb725780 100644
--- a/lib/pldmfw/pldmfw.c
+++ b/lib/pldmfw/pldmfw.c
@@ -728,6 +728,9 @@ pldm_send_package_data(struct pldmfw_priv *data)
 	struct pldmfw_record *record = data->matching_record;
 	const struct pldmfw_ops *ops = data->context->ops;

+	if (!ops->send_package_data)
+		return 0;
+
 	return ops->send_package_data(data->context, record->package_data,
 				      record->package_data_len);
 }
@@ -755,6 +758,9 @@ pldm_send_component_tables(struct pldmfw_priv *data)
 		if (!test_bit(index, bitmap))
 			continue;

+		if (!data->context->ops->send_component_table)
+			continue;
+
 		/* determine whether this is the start, middle, end, or both
 		 * the start and end of the component tables
 		 */
--
2.47.1
Re: [PATCH net-next v4 1/5] pldmfw: Don't require send_package_data or send_component_table to be defined
Posted by Jacob Keller 7 months, 1 week ago

On 5/9/2025 5:21 PM, Lee Trager wrote:
> Not all drivers require send_package_data or send_component_table when
> updating firmware. Instead of forcing drivers to implement a stub allow
> these functions to go undefined.
> 
> Signed-off-by: Lee Trager <lee@trager.us>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Makes sense.

Acked-by: Jacob Keller <jacob.e.keller@intel.com>

> ---
>  lib/pldmfw/pldmfw.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/lib/pldmfw/pldmfw.c b/lib/pldmfw/pldmfw.c
> index 6264e2013f25..b45ceb725780 100644
> --- a/lib/pldmfw/pldmfw.c
> +++ b/lib/pldmfw/pldmfw.c
> @@ -728,6 +728,9 @@ pldm_send_package_data(struct pldmfw_priv *data)
>  	struct pldmfw_record *record = data->matching_record;
>  	const struct pldmfw_ops *ops = data->context->ops;
> 
> +	if (!ops->send_package_data)
> +		return 0;
> +
>  	return ops->send_package_data(data->context, record->package_data,
>  				      record->package_data_len);
>  }
> @@ -755,6 +758,9 @@ pldm_send_component_tables(struct pldmfw_priv *data)
>  		if (!test_bit(index, bitmap))
>  			continue;
> 
> +		if (!data->context->ops->send_component_table)
> +			continue;
> +
>  		/* determine whether this is the start, middle, end, or both
>  		 * the start and end of the component tables
>  		 */
> --
> 2.47.1
Re: [PATCH net-next v4 1/5] pldmfw: Don't require send_package_data or send_component_table to be defined
Posted by Simon Horman 7 months, 1 week ago
On Fri, May 09, 2025 at 05:21:13PM -0700, Lee Trager wrote:
> Not all drivers require send_package_data or send_component_table when
> updating firmware. Instead of forcing drivers to implement a stub allow
> these functions to go undefined.
> 
> Signed-off-by: Lee Trager <lee@trager.us>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Simon Horman <horms@kernel.org>