LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Suwan Kim <suwan.kim027@gmail.com>
To: shuah <shuah@kernel.org>
Cc: valentina.manea.m@gmail.com, gregkh@linuxfoundation.org,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] usbip: Remove repeated setting of hcd->state in vhci_bus_suspend()
Date: Wed, 8 May 2019 00:49:19 +0900	[thread overview]
Message-ID: <20190507154918.GA2427@localhost.localdomain> (raw)
In-Reply-To: <440389ab-62c3-7bc2-0e9b-0b302a88c929@kernel.org>

Hi Shuah,

On Mon, May 06, 2019 at 09:13:02AM -0600, shuah wrote:
> On 5/6/19 6:55 AM, Suwan Kim wrote:
> > When hcd suspends execution, hcd_bus_suspend() calls vhci_bus_suspend()
> > which sets hcd->state as HC_STATE_SUSPENDED. But after calling
> > vhci_bus_suspend(), hcd_bus_suspend() also sets hcd->state as
> > HC_STATE_SUSPENDED.
> > So, setting hcd->state in vhci_hcd_suspend() is unnecessary.
> > 
> > Signed-off-by: Suwan Kim <suwan.kim027@gmail.com>
> > ---
> >   drivers/usb/usbip/vhci_hcd.c | 4 ----
> >   1 file changed, 4 deletions(-)
> > 
> > diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c
> > index 667d9c0ec905..e6f378d00fb6 100644
> > --- a/drivers/usb/usbip/vhci_hcd.c
> > +++ b/drivers/usb/usbip/vhci_hcd.c
> > @@ -1238,10 +1238,6 @@ static int vhci_bus_suspend(struct usb_hcd *hcd)
> >   	dev_dbg(&hcd->self.root_hub->dev, "%s\n", __func__);
> > -	spin_lock_irqsave(&vhci->lock, flags);
> > -	hcd->state = HC_STATE_SUSPENDED;
> > -	spin_unlock_irqrestore(&vhci->lock, flags);
> > -
> >   	return 0;
> >   }
> > 
> 
> Tell me more about why you think this change is needed? How did you test
> this change?

I think that host controller specific functions, vhci_bus_resume()
or vhci_bus_suspend() in the case of vhci, usually process host
controller specific data (struct vhci_hcd) not a generic data
(struct usb_hcd). The generic data is usually processed by generic HCD
layer. But vhci_bus_resume() and vhci_bus_suspend() set generic data
(hcd->state) and moreover this variable is set in generic HCD layer
once again(hcd_bus_resume() and hcd_bus_suspend()).

So, i think host controller specific functions (vhci_bus_resume()
and vhci_bus_suspend()) don't need to set the generic data that is
"hcd->state = HC_STATE_RUNNING or HC_STATE_SUSPEND".

For test, I loaded vhci-hcd module, suspended and resumed my computer
and checked hcd->state variable. There is no difference compared with
not modified version because my patch just removes repeated and
unnecessary part.

Regards

Suwan Kim

  reply	other threads:[~2019-05-07 15:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-06 12:55 Suwan Kim
2019-05-06 12:55 ` [PATCH 2/2] usbip: Remove repeated setting of hcd->state in vhci_bus_resume() Suwan Kim
2019-05-06 15:16   ` shuah
2019-05-06 15:13 ` [PATCH 1/2] usbip: Remove repeated setting of hcd->state in vhci_bus_suspend() shuah
2019-05-07 15:49   ` Suwan Kim [this message]
2019-05-08 17:28     ` shuah
2019-05-14 11:58       ` Suwan Kim

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=20190507154918.GA2427@localhost.localdomain \
    --to=suwan.kim027@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=valentina.manea.m@gmail.com \
    --subject='Re: [PATCH 1/2] usbip: Remove repeated setting of hcd->state in vhci_bus_suspend()' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).