netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.com>
To: Hayes Wang <hayeswang@realtek.com>, netdev@vger.kernel.org
Cc: nic_swsd@realtek.com, linux-kernel@vger.kernel.org,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH net-next 1/2] r8152: split rtl8152_resume function
Date: Mon, 12 Jun 2017 14:33:26 +0200	[thread overview]
Message-ID: <1497270806.15677.18.camel@suse.com> (raw)
In-Reply-To: <1394712342-15778-273-Taiwan-albertk@realtek.com>

Am Montag, den 12.06.2017, 16:21 +0800 schrieb Hayes Wang:
> Split rtl8152_resume() into rtl8152_runtime_resume() and
> rtl8152_system_resume().
> 
> Signed-off-by: Hayes Wang <hayeswang@realtek.com>
> ---
>  drivers/net/usb/r8152.c | 99 ++++++++++++++++++++++++++++++-------------------
>  1 file changed, 61 insertions(+), 38 deletions(-)
> 
> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> index 5a02053..3257955 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c
> @@ -3686,6 +3686,61 @@ static bool delay_autosuspend(struct r8152 *tp)
>                 return false;
>  }
>  
> +static int rtl8152_runtime_resume(struct r8152 *tp)
> +{
> +       struct net_device *netdev = tp->netdev;
> +
> +       if (netif_running(netdev) && netdev->flags & IFF_UP) {
> +               struct napi_struct *napi = &tp->napi;
> +
> +               tp->rtl_ops.autosuspend_en(tp, false);
> +               napi_disable(napi);
> +               set_bit(WORK_ENABLE, &tp->flags);
> +
> +               if (netif_carrier_ok(netdev)) {
> +                       if (rtl8152_get_speed(tp) & LINK_STATUS) {
> +                               rtl_start_rx(tp);
> +                       } else {
> +                               netif_carrier_off(netdev);
> +                               tp->rtl_ops.disable(tp);
> +                               netif_info(tp, link, netdev, "linking down\n");
> +                       }
> +               }
> +
> +               napi_enable(napi);
> +               clear_bit(SELECTIVE_SUSPEND, &tp->flags);
> +               smp_mb__after_atomic();
> +
> +               if (!list_empty(&tp->rx_done))
> +                       napi_schedule(&tp->napi);
> +
> +               usb_submit_urb(tp->intr_urb, GFP_KERNEL);

If you ever built a device with included storage, this can deadlock,
as you may want to wake up a device for memory that is needed to wake
up a device. Use GFP_NOIO in resume() and reset_resume(), always.

	Regards
		Oliver

  reply	other threads:[~2017-06-12 12:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-12  8:21 [PATCH net-next 0/2] r8152: adjust runtime suspend/resume Hayes Wang
     [not found] ` <1394712342-15778-272-Taiwan-albertk-Rasf1IRRPZFBDgjK7y7TUQ@public.gmane.org>
2017-06-12  8:21   ` [PATCH net-next 1/2] r8152: split rtl8152_resume function Hayes Wang
2017-06-12 12:33     ` Oliver Neukum [this message]
2017-06-13  2:27       ` Hayes Wang
2017-06-12  8:21 ` [PATCH net-next 2/2] r8152: move calling delay_autosuspend function Hayes Wang
2017-06-13  7:14 ` [PATCH net-next v2 0/2] r8152: adjust runtime suspend/resume Hayes Wang
2017-06-13  7:14   ` [PATCH net-next v2 1/2] r8152: split rtl8152_resume function Hayes Wang
2017-06-13  7:14   ` [PATCH net-next v2 2/2] r8152: move calling delay_autosuspend function Hayes Wang
2017-06-13 17:01   ` [PATCH net-next v2 0/2] r8152: adjust runtime suspend/resume David Miller
2017-06-16  3:29     ` Hayes Wang
2017-06-16 15:37       ` David Miller

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=1497270806.15677.18.camel@suse.com \
    --to=oneukum@suse.com \
    --cc=hayeswang@realtek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    /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 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).