[PATCH v10 3/3] firmware: ti_sci: Remove constant 0 function arguments

Markus Schneider-Pargmann (TI.com) posted 3 patches 1 month, 2 weeks ago
[PATCH v10 3/3] firmware: ti_sci: Remove constant 0 function arguments
Posted by Markus Schneider-Pargmann (TI.com) 1 month, 2 weeks ago
ti_sci_cmd_prepare_sleep takes three arguments ctx_lo, ctx_hi and
debug_flags which are always 0 for the caller. Remove these arguments as
they are basically unused.

Signed-off-by: Markus Schneider-Pargmann (TI.com) <msp@baylibre.com>
---
 drivers/firmware/ti_sci.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
index 811507ded63ac784ad6c6ad77b2f827768f3f3c7..023c603ae58cb5df176c66eec429bd0b4037b798 100644
--- a/drivers/firmware/ti_sci.c
+++ b/drivers/firmware/ti_sci.c
@@ -1664,14 +1664,10 @@ static int ti_sci_cmd_clk_get_freq(const struct ti_sci_handle *handle,
  * ti_sci_cmd_prepare_sleep() - Prepare system for system suspend
  * @handle:		pointer to TI SCI handle
  * @mode:		Device identifier
- * @ctx_lo:		Low part of address for context save
- * @ctx_hi:		High part of address for context save
- * @debug_flags:	Debug flags to pass to firmware
  *
  * Return: 0 if all went well, else returns appropriate error value.
  */
-static int ti_sci_cmd_prepare_sleep(const struct ti_sci_handle *handle, u8 mode,
-				    u32 ctx_lo, u32 ctx_hi, u32 debug_flags)
+static int ti_sci_cmd_prepare_sleep(const struct ti_sci_handle *handle, u8 mode)
 {
 	u32 msg_flags = mode == TISCI_MSG_VALUE_SLEEP_MODE_PARTIAL_IO ?
 			TI_SCI_FLAG_REQ_GENERIC_NORESPONSE :
@@ -1702,9 +1698,9 @@ static int ti_sci_cmd_prepare_sleep(const struct ti_sci_handle *handle, u8 mode,
 
 	req = (struct ti_sci_msg_req_prepare_sleep *)xfer->xfer_buf;
 	req->mode = mode;
-	req->ctx_lo = ctx_lo;
-	req->ctx_hi = ctx_hi;
-	req->debug_flags = debug_flags;
+	req->ctx_lo = 0;
+	req->ctx_hi = 0;
+	req->debug_flags = 0;
 
 	ret = ti_sci_do_xfer(info, xfer);
 	if (ret) {
@@ -3729,7 +3725,7 @@ static int ti_sci_sys_off_handler(struct sys_off_data *data)
 
 	dev_info(info->dev, "Entering Partial-IO because a powered wakeup-enabled device was found.\n");
 
-	ret = ti_sci_cmd_prepare_sleep(handle, TISCI_MSG_VALUE_SLEEP_MODE_PARTIAL_IO, 0, 0, 0);
+	ret = ti_sci_cmd_prepare_sleep(handle, TISCI_MSG_VALUE_SLEEP_MODE_PARTIAL_IO);
 	if (ret) {
 		dev_err(info->dev,
 			"Failed to enter Partial-IO %pe, trying to do an emergency restart\n",
@@ -3768,8 +3764,7 @@ static int ti_sci_prepare_system_suspend(struct ti_sci_info *info)
 			 * internal use and can be 0
 			 */
 			return ti_sci_cmd_prepare_sleep(&info->handle,
-							TISCI_MSG_VALUE_SLEEP_MODE_DM_MANAGED,
-							0, 0, 0);
+							TISCI_MSG_VALUE_SLEEP_MODE_DM_MANAGED);
 		} else {
 			/* DM Managed is not supported by the firmware. */
 			dev_err(info->dev, "Suspend to memory is not supported by the firmware\n");

-- 
2.51.0
Re: [PATCH v10 3/3] firmware: ti_sci: Remove constant 0 function arguments
Posted by Andrew Davis 1 month ago
On 11/3/25 6:42 AM, Markus Schneider-Pargmann (TI.com) wrote:
> ti_sci_cmd_prepare_sleep takes three arguments ctx_lo, ctx_hi and
> debug_flags which are always 0 for the caller. Remove these arguments as
> they are basically unused.
> 

Does that matter? The functionality is still available and when we do
use those arguments we will just have to revert this patch.

Andrew

> Signed-off-by: Markus Schneider-Pargmann (TI.com) <msp@baylibre.com>
> ---
>   drivers/firmware/ti_sci.c | 17 ++++++-----------
>   1 file changed, 6 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
> index 811507ded63ac784ad6c6ad77b2f827768f3f3c7..023c603ae58cb5df176c66eec429bd0b4037b798 100644
> --- a/drivers/firmware/ti_sci.c
> +++ b/drivers/firmware/ti_sci.c
> @@ -1664,14 +1664,10 @@ static int ti_sci_cmd_clk_get_freq(const struct ti_sci_handle *handle,
>    * ti_sci_cmd_prepare_sleep() - Prepare system for system suspend
>    * @handle:		pointer to TI SCI handle
>    * @mode:		Device identifier
> - * @ctx_lo:		Low part of address for context save
> - * @ctx_hi:		High part of address for context save
> - * @debug_flags:	Debug flags to pass to firmware
>    *
>    * Return: 0 if all went well, else returns appropriate error value.
>    */
> -static int ti_sci_cmd_prepare_sleep(const struct ti_sci_handle *handle, u8 mode,
> -				    u32 ctx_lo, u32 ctx_hi, u32 debug_flags)
> +static int ti_sci_cmd_prepare_sleep(const struct ti_sci_handle *handle, u8 mode)
>   {
>   	u32 msg_flags = mode == TISCI_MSG_VALUE_SLEEP_MODE_PARTIAL_IO ?
>   			TI_SCI_FLAG_REQ_GENERIC_NORESPONSE :
> @@ -1702,9 +1698,9 @@ static int ti_sci_cmd_prepare_sleep(const struct ti_sci_handle *handle, u8 mode,
>   
>   	req = (struct ti_sci_msg_req_prepare_sleep *)xfer->xfer_buf;
>   	req->mode = mode;
> -	req->ctx_lo = ctx_lo;
> -	req->ctx_hi = ctx_hi;
> -	req->debug_flags = debug_flags;
> +	req->ctx_lo = 0;
> +	req->ctx_hi = 0;
> +	req->debug_flags = 0;
>   
>   	ret = ti_sci_do_xfer(info, xfer);
>   	if (ret) {
> @@ -3729,7 +3725,7 @@ static int ti_sci_sys_off_handler(struct sys_off_data *data)
>   
>   	dev_info(info->dev, "Entering Partial-IO because a powered wakeup-enabled device was found.\n");
>   
> -	ret = ti_sci_cmd_prepare_sleep(handle, TISCI_MSG_VALUE_SLEEP_MODE_PARTIAL_IO, 0, 0, 0);
> +	ret = ti_sci_cmd_prepare_sleep(handle, TISCI_MSG_VALUE_SLEEP_MODE_PARTIAL_IO);
>   	if (ret) {
>   		dev_err(info->dev,
>   			"Failed to enter Partial-IO %pe, trying to do an emergency restart\n",
> @@ -3768,8 +3764,7 @@ static int ti_sci_prepare_system_suspend(struct ti_sci_info *info)
>   			 * internal use and can be 0
>   			 */
>   			return ti_sci_cmd_prepare_sleep(&info->handle,
> -							TISCI_MSG_VALUE_SLEEP_MODE_DM_MANAGED,
> -							0, 0, 0);
> +							TISCI_MSG_VALUE_SLEEP_MODE_DM_MANAGED);
>   		} else {
>   			/* DM Managed is not supported by the firmware. */
>   			dev_err(info->dev, "Suspend to memory is not supported by the firmware\n");
>
Re: [PATCH v10 3/3] firmware: ti_sci: Remove constant 0 function arguments
Posted by Nishanth Menon 1 month ago
On 09:26-20251112, Andrew Davis wrote:
> On 11/3/25 6:42 AM, Markus Schneider-Pargmann (TI.com) wrote:
> > ti_sci_cmd_prepare_sleep takes three arguments ctx_lo, ctx_hi and
> > debug_flags which are always 0 for the caller. Remove these arguments as
> > they are basically unused.
> > 
> 
> Does that matter? The functionality is still available and when we do
> use those arguments we will just have to revert this patch.

I agree. please leave the existing params alone. no point in optimizing
it.

> 
> > Signed-off-by: Markus Schneider-Pargmann (TI.com) <msp@baylibre.com>
> > ---
> >   drivers/firmware/ti_sci.c | 17 ++++++-----------
> >   1 file changed, 6 insertions(+), 11 deletions(-)
> > 
> > diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
> > index 811507ded63ac784ad6c6ad77b2f827768f3f3c7..023c603ae58cb5df176c66eec429bd0b4037b798 100644
> > --- a/drivers/firmware/ti_sci.c
> > +++ b/drivers/firmware/ti_sci.c
> > @@ -1664,14 +1664,10 @@ static int ti_sci_cmd_clk_get_freq(const struct ti_sci_handle *handle,
> >    * ti_sci_cmd_prepare_sleep() - Prepare system for system suspend
> >    * @handle:		pointer to TI SCI handle
> >    * @mode:		Device identifier
> > - * @ctx_lo:		Low part of address for context save
> > - * @ctx_hi:		High part of address for context save
> > - * @debug_flags:	Debug flags to pass to firmware
> >    *
> >    * Return: 0 if all went well, else returns appropriate error value.
> >    */
> > -static int ti_sci_cmd_prepare_sleep(const struct ti_sci_handle *handle, u8 mode,
> > -				    u32 ctx_lo, u32 ctx_hi, u32 debug_flags)
> > +static int ti_sci_cmd_prepare_sleep(const struct ti_sci_handle *handle, u8 mode)
> >   {
> >   	u32 msg_flags = mode == TISCI_MSG_VALUE_SLEEP_MODE_PARTIAL_IO ?
> >   			TI_SCI_FLAG_REQ_GENERIC_NORESPONSE :
> > @@ -1702,9 +1698,9 @@ static int ti_sci_cmd_prepare_sleep(const struct ti_sci_handle *handle, u8 mode,
> >   	req = (struct ti_sci_msg_req_prepare_sleep *)xfer->xfer_buf;
> >   	req->mode = mode;
> > -	req->ctx_lo = ctx_lo;
> > -	req->ctx_hi = ctx_hi;
> > -	req->debug_flags = debug_flags;
> > +	req->ctx_lo = 0;
> > +	req->ctx_hi = 0;
> > +	req->debug_flags = 0;
> >   	ret = ti_sci_do_xfer(info, xfer);
> >   	if (ret) {
> > @@ -3729,7 +3725,7 @@ static int ti_sci_sys_off_handler(struct sys_off_data *data)
> >   	dev_info(info->dev, "Entering Partial-IO because a powered wakeup-enabled device was found.\n");
> > -	ret = ti_sci_cmd_prepare_sleep(handle, TISCI_MSG_VALUE_SLEEP_MODE_PARTIAL_IO, 0, 0, 0);
> > +	ret = ti_sci_cmd_prepare_sleep(handle, TISCI_MSG_VALUE_SLEEP_MODE_PARTIAL_IO);
> >   	if (ret) {
> >   		dev_err(info->dev,
> >   			"Failed to enter Partial-IO %pe, trying to do an emergency restart\n",
> > @@ -3768,8 +3764,7 @@ static int ti_sci_prepare_system_suspend(struct ti_sci_info *info)
> >   			 * internal use and can be 0
> >   			 */
> >   			return ti_sci_cmd_prepare_sleep(&info->handle,
> > -							TISCI_MSG_VALUE_SLEEP_MODE_DM_MANAGED,
> > -							0, 0, 0);
> > +							TISCI_MSG_VALUE_SLEEP_MODE_DM_MANAGED);
> >   		} else {
> >   			/* DM Managed is not supported by the firmware. */
> >   			dev_err(info->dev, "Suspend to memory is not supported by the firmware\n");
> > 
> 

-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
https://ti.com/opensource
Re: [PATCH v10 3/3] firmware: ti_sci: Remove constant 0 function arguments
Posted by Dhruva Gole 1 month ago
Nishanth, Andrew,

On Nov 12, 2025 at 09:28:53 -0600, Nishanth Menon wrote:
> On 09:26-20251112, Andrew Davis wrote:
> > On 11/3/25 6:42 AM, Markus Schneider-Pargmann (TI.com) wrote:
> > > ti_sci_cmd_prepare_sleep takes three arguments ctx_lo, ctx_hi and
> > > debug_flags which are always 0 for the caller. Remove these arguments as
> > > they are basically unused.
> > > 
> > 
> > Does that matter? The functionality is still available and when we do
> > use those arguments we will just have to revert this patch.
> 
> I agree. please leave the existing params alone. no point in optimizing
> it.

Thanks for reviewing.

Since there seem to be strong opinions from you both against this, can we
simply drop this patch while applying?
I am just quoting author's intent from the cover letter change log [1]:

	Moved the removal of the ctx_lo, ctx_hi and debug_flags to the end of
	the series so merging is optional.

We can avoid a respin just to drop this patch then, thoughts?

[1] https://lore.kernel.org/all/20251103-topic-am62-partialio-v6-12-b4-v10-0-0557e858d747@baylibre.com/

> 
> > 
> > > Signed-off-by: Markus Schneider-Pargmann (TI.com) <msp@baylibre.com>
> > > ---
> > >   drivers/firmware/ti_sci.c | 17 ++++++-----------
> > >   1 file changed, 6 insertions(+), 11 deletions(-)
> > > 
> > > diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
> > > index 811507ded63ac784ad6c6ad77b2f827768f3f3c7..023c603ae58cb5df176c66eec429bd0b4037b798 100644
> > > --- a/drivers/firmware/ti_sci.c
> > > +++ b/drivers/firmware/ti_sci.c
> > > @@ -1664,14 +1664,10 @@ static int ti_sci_cmd_clk_get_freq(const struct ti_sci_handle *handle,
> > >    * ti_sci_cmd_prepare_sleep() - Prepare system for system suspend
> > >    * @handle:		pointer to TI SCI handle
> > >    * @mode:		Device identifier
> > > - * @ctx_lo:		Low part of address for context save
> > > - * @ctx_hi:		High part of address for context save
> > > - * @debug_flags:	Debug flags to pass to firmware
> > >    *
> > >    * Return: 0 if all went well, else returns appropriate error value.
> > >    */
> > > -static int ti_sci_cmd_prepare_sleep(const struct ti_sci_handle *handle, u8 mode,
> > > -				    u32 ctx_lo, u32 ctx_hi, u32 debug_flags)
> > > +static int ti_sci_cmd_prepare_sleep(const struct ti_sci_handle *handle, u8 mode)
> > >   {
> > >   	u32 msg_flags = mode == TISCI_MSG_VALUE_SLEEP_MODE_PARTIAL_IO ?
> > >   			TI_SCI_FLAG_REQ_GENERIC_NORESPONSE :
> > > @@ -1702,9 +1698,9 @@ static int ti_sci_cmd_prepare_sleep(const struct ti_sci_handle *handle, u8 mode,
> > >   	req = (struct ti_sci_msg_req_prepare_sleep *)xfer->xfer_buf;
> > >   	req->mode = mode;
> > > -	req->ctx_lo = ctx_lo;
> > > -	req->ctx_hi = ctx_hi;
> > > -	req->debug_flags = debug_flags;
> > > +	req->ctx_lo = 0;
> > > +	req->ctx_hi = 0;
> > > +	req->debug_flags = 0;
> > >   	ret = ti_sci_do_xfer(info, xfer);
> > >   	if (ret) {
> > > @@ -3729,7 +3725,7 @@ static int ti_sci_sys_off_handler(struct sys_off_data *data)
> > >   	dev_info(info->dev, "Entering Partial-IO because a powered wakeup-enabled device was found.\n");
> > > -	ret = ti_sci_cmd_prepare_sleep(handle, TISCI_MSG_VALUE_SLEEP_MODE_PARTIAL_IO, 0, 0, 0);
> > > +	ret = ti_sci_cmd_prepare_sleep(handle, TISCI_MSG_VALUE_SLEEP_MODE_PARTIAL_IO);
> > >   	if (ret) {
> > >   		dev_err(info->dev,
> > >   			"Failed to enter Partial-IO %pe, trying to do an emergency restart\n",
> > > @@ -3768,8 +3764,7 @@ static int ti_sci_prepare_system_suspend(struct ti_sci_info *info)
> > >   			 * internal use and can be 0
> > >   			 */
> > >   			return ti_sci_cmd_prepare_sleep(&info->handle,
> > > -							TISCI_MSG_VALUE_SLEEP_MODE_DM_MANAGED,
> > > -							0, 0, 0);
> > > +							TISCI_MSG_VALUE_SLEEP_MODE_DM_MANAGED);
> > >   		} else {
> > >   			/* DM Managed is not supported by the firmware. */
> > >   			dev_err(info->dev, "Suspend to memory is not supported by the firmware\n");
> > > 
> > 
> 
> -- 
> Regards,
> Nishanth Menon
> Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
> https://ti.com/opensource

-- 
Best regards,
Dhruva Gole
Texas Instruments Incorporated