All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: "Peter Chen (CIX)" <peter.chen@kernel.org>,
	Oliver Neukum <oneukum@suse.com>
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH] USB: initialize struct otg_fsm earlier
Date: Mon, 21 Apr 2025 11:15:37 +0300	[thread overview]
Message-ID: <410a1a6a-d866-44ad-8592-5babd3fe50b1@gmail.com> (raw)
In-Reply-To: <20250421014545.GA3578913@nchen-desktop>

21.04.2025 04:45, Peter Chen (CIX) пишет:
> On 25-04-17 13:14:54, Oliver Neukum wrote:
>> The earlier fix bf88fef0b6f1 ("usb: otg-fsm: Fix hrtimer list
>> corruption") in effect hid an issue with intialization.
>> In effect it replaces the racy continous reinitialization
>> of fsm->hnp_polling_work with a delayed one-time
>> initialization.
>>
>> This just makes no sense. As a single initialization
>> is sufficient, the clean solution is just to do it once
>> and do it early enough.
>>
>> Signed-off-by: Oliver Neukum <oneukum@suse.com>
> 
> Add Dmitry.
> 
> I am okay for this change, and see what's the Dmitry's response.

Thanks for notifying me

> Peter
>> ---
>>  drivers/usb/common/usb-otg-fsm.c | 7 +------
>>  drivers/usb/phy/phy-fsl-usb.c    | 1 +
>>  include/linux/usb/otg-fsm.h      | 2 +-
>>  3 files changed, 3 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c
>> index e11803225775..a22d536ccdf8 100644
>> --- a/drivers/usb/common/usb-otg-fsm.c
>> +++ b/drivers/usb/common/usb-otg-fsm.c
>> @@ -117,7 +117,7 @@ static void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state)
>>  	}
>>  }
>>  
>> -static void otg_hnp_polling_work(struct work_struct *work)
>> +void otg_hnp_polling_work(struct work_struct *work)
>>  {
>>  	struct otg_fsm *fsm = container_of(to_delayed_work(work),
>>  				struct otg_fsm, hnp_polling_work);
>> @@ -193,11 +193,6 @@ static void otg_start_hnp_polling(struct otg_fsm *fsm)
>>  	if (!fsm->host_req_flag)
>>  		return;
>>  
>> -	if (!fsm->hnp_work_inited) {
>> -		INIT_DELAYED_WORK(&fsm->hnp_polling_work, otg_hnp_polling_work);
>> -		fsm->hnp_work_inited = true;
>> -	}
>> -
>>  	schedule_delayed_work(&fsm->hnp_polling_work,
>>  					msecs_to_jiffies(T_HOST_REQ_POLL));
>>  }
>> diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c
>> index 40ac68e52cee..7f0fdba689de 100644
>> --- a/drivers/usb/phy/phy-fsl-usb.c
>> +++ b/drivers/usb/phy/phy-fsl-usb.c
>> @@ -845,6 +845,7 @@ int usb_otg_start(struct platform_device *pdev)
>>  
>>  	/* Initialize the state machine structure with default values */
>>  	SET_OTG_STATE(otg_trans, OTG_STATE_UNDEFINED);
>> +	INIT_DELAYED_WORK(&fsm->hnp_polling_work, otg_hnp_polling_work);
>>  	fsm->otg = p_otg->phy.otg;

The original problem was fixed for the ChipIdea driver in the common USB
code, while this phy-fsl-usb is the Freeescale USB driver that has
nothing to do with the ChipIdea and the common code, AFAICT. Hence this
patch should be wrong. I suggest not to change the original logic.


  reply	other threads:[~2025-04-21  8:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-17 11:14 [PATCH] USB: initialize struct otg_fsm earlier Oliver Neukum
2025-04-21  1:45 ` Peter Chen (CIX)
2025-04-21  8:15   ` Dmitry Osipenko [this message]
2025-04-22  1:23     ` Peter Chen (CIX)
2025-04-23 13:37       ` Dmitry Osipenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=410a1a6a-d866-44ad-8592-5babd3fe50b1@gmail.com \
    --to=digetx@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=oneukum@suse.com \
    --cc=peter.chen@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.