From owner-svn-src-head@freebsd.org Tue Apr 26 05:21:46 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A628B1D695 for ; Tue, 26 Apr 2016 05:21:46 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x236.google.com (mail-io0-x236.google.com [IPv6:2607:f8b0:4001:c06::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2D99A1C6F for ; Tue, 26 Apr 2016 05:21:46 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x236.google.com with SMTP id f89so6096354ioi.0 for ; Mon, 25 Apr 2016 22:21:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=PEr7DenyAhSq329YOKPaUB/KP4LdqFkVy3d4Ik7hxSA=; b=bXWMlESg4AAVO2FhNmO6K5DYCU9VRQRSpev12Vy86iHa1+D8E1p8Y6N4/8o5VcZemN 14tU+JRnKqjlhIyfdz22n+zOxI6HZgmYRzW0fYwWD7LsdOyWbr6VsecW5kCoCqI5P3+F Ie3cfjsTvqA2k1e5viT1z772NGGD3kBwaB0dBk+Nobc7pdb0MaKuXPIsxefeERkPwaIW trpepF2ItGoruyteYWvBS0jf1vMwLjoBKaUGzLwoS6gd9d2ITUfj3KSET8sG1USZViBa wa4A7XLDcVJfKIYa0T2Ylaq4h+3+bb3uTPFpApbyCYn+c4jQ/yKfoFJdNanID6vu15Gw lIRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=PEr7DenyAhSq329YOKPaUB/KP4LdqFkVy3d4Ik7hxSA=; b=GNJK23g1XN2Bb1k4Pi4PxT6is4fiz7cty1Zch3HfrePVZG1XAyCKJ0KMxvMCskQk02 N+GvfLY5yeXWb8LXZsdsdYxMjeBe/Uoc1d0auYzg0zewzBhthzrwYntRv6npgsenb1Ji jdgKETTZeXYm9D/xjHU5E3qMSh/ufcilV0lQGV5jNKgwAOa+Cf2kmt0/uBnfQwVkpeAQ AHYQm33xtOZJJ7WWXdHE6C/0R1cj1SidNpBrUjuCmfoGmzcpN4ptoQhRPhjGHtN5REfj 3SDxTk1xSQ3iMXfk5YtYkPZhUGG9qjp6SZk6/xeXliNWg40Y2dz66xa11OHSOYdItXmQ BgQg== X-Gm-Message-State: AOPr4FV3sVCtIKvvc6qwIKAyBj7b3FGy924l3dFyVy4aHB0Ffs4oHovtRicQH3Yd4bKe+l4HIYF9p9LNdbm4VA== MIME-Version: 1.0 X-Received: by 10.107.40.9 with SMTP id o9mr1073915ioo.183.1461648105584; Mon, 25 Apr 2016 22:21:45 -0700 (PDT) Sender: wlosh@bsdimp.com Received: by 10.79.104.197 with HTTP; Mon, 25 Apr 2016 22:21:45 -0700 (PDT) X-Originating-IP: [50.253.99.174] In-Reply-To: References: <201604260440.u3Q4exZD045896@repo.freebsd.org> Date: Mon, 25 Apr 2016 23:21:45 -0600 X-Google-Sender-Auth: -eobxNpf6QmMxxobWwS81NtaxVY Message-ID: Subject: Re: svn commit: r298612 - head/sys/dev/iwm From: Warner Losh To: Ravi Pokala Cc: Adrian Chadd , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2016 05:21:46 -0000 On Mon, Apr 25, 2016 at 10:45 PM, Ravi Pokala wrote: > > do_stop = !! (sc->sc_ic.ic_nrunning > 0); > > Why the double-negation? Isn't > > do_stop = (sc->sc_ic.ic_nrunning > 0); > > equivalent? > It is. However the !! style is from Linux. It converts a bit value to a 0/1 value. Since foo > 0 already is a Boolean, it isn't needed here. Warner > -Ravi (rpokala@) > > > > -----Original Message----- > From: on behalf of Adrian Chadd > > Date: 2016-04-25, Monday at 21:40 > To: , , < > svn-src-head@freebsd.org> > Subject: svn commit: r298612 - head/sys/dev/iwm > > >Author: adrian > >Date: Tue Apr 26 04:40:59 2016 > >New Revision: 298612 > >URL: https://svnweb.freebsd.org/changeset/base/298612 > > > >Log: > > [iwm] implement suspend/resume through ieee80211_{suspend,resume}_all > > > > This allows wifi to associate correctly after a suspend/resume cycle. > > > > Yes, I'm using this now day to day. > > > > Tested: > > > > * Intel 7260AC, STA mode > > > >Modified: > > head/sys/dev/iwm/if_iwm.c > > head/sys/dev/iwm/if_iwmvar.h > > > >Modified: head/sys/dev/iwm/if_iwm.c > > >============================================================================== > >--- head/sys/dev/iwm/if_iwm.c Tue Apr 26 03:24:28 2016 (r298611) > >+++ head/sys/dev/iwm/if_iwm.c Tue Apr 26 04:40:59 2016 (r298612) > >@@ -4934,6 +4934,8 @@ iwm_init_task(void *arg1) > > static int > > iwm_resume(device_t dev) > > { > >+ struct iwm_softc *sc = device_get_softc(dev); > >+ int do_reinit = 0; > > uint16_t reg; > > > > /* Clear device-specific "PCI retry timeout" register (41h). */ > >@@ -4941,17 +4943,33 @@ iwm_resume(device_t dev) > > pci_write_config(dev, 0x40, reg & ~0xff00, sizeof(reg)); > > iwm_init_task(device_get_softc(dev)); > > > >+ IWM_LOCK(sc); > >+ if (sc->sc_flags & IWM_FLAG_DORESUME) { > >+ sc->sc_flags &= ~IWM_FLAG_DORESUME; > >+ do_reinit = 1; > >+ } > >+ IWM_UNLOCK(sc); > >+ > >+ if (do_reinit) > >+ ieee80211_resume_all(&sc->sc_ic); > >+ > > return 0; > > } > > > > static int > > iwm_suspend(device_t dev) > > { > >+ int do_stop = 0; > > struct iwm_softc *sc = device_get_softc(dev); > > > >- if (sc->sc_ic.ic_nrunning > 0) { > >+ do_stop = !! (sc->sc_ic.ic_nrunning > 0); > >+ > >+ ieee80211_suspend_all(&sc->sc_ic); > >+ > >+ if (do_stop) { > > IWM_LOCK(sc); > > iwm_stop(sc); > >+ sc->sc_flags |= IWM_FLAG_DORESUME; > > IWM_UNLOCK(sc); > > } > > > > > >Modified: head/sys/dev/iwm/if_iwmvar.h > > >============================================================================== > >--- head/sys/dev/iwm/if_iwmvar.h Tue Apr 26 03:24:28 2016 > (r298611) > >+++ head/sys/dev/iwm/if_iwmvar.h Tue Apr 26 04:40:59 2016 > (r298612) > >@@ -405,6 +405,7 @@ struct iwm_softc { > > #define IWM_FLAG_STOPPED (1 << 2) > > #define IWM_FLAG_RFKILL (1 << 3) > > #define IWM_FLAG_BUSY (1 << 4) > >+#define IWM_FLAG_DORESUME (1 << 5) > > > > struct intr_config_hook sc_preinit_hook; > > struct callout sc_watchdog_to; > > > > >