From owner-svn-src-all@freebsd.org Tue Apr 26 13:27:52 2016 Return-Path: Delivered-To: svn-src-all@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 197DCB1D269; Tue, 26 Apr 2016 13:27:52 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-io0-x233.google.com (mail-io0-x233.google.com [IPv6:2607:f8b0:4001:c06::233]) (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 D8D2916EF; Tue, 26 Apr 2016 13:27:51 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-io0-x233.google.com with SMTP id u185so17933444iod.3; Tue, 26 Apr 2016 06:27:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=TT+Qcc/VJgBle0he5ZuMesCmCwxXdxF1eJQi/8c4pT8=; b=xFo6ZESLSWYodPitj8bB5PL2C4YwfUH7v2HDjJRx0+4BsoqTc1Cx/hImJUpIAQrYnG eErI3NjV7A2aoJmpS4W+1hlgCG96Sq7iccZOcq3pIJTFlcM81rj7FXDyPtOEwfG7h+pb f+zL0y6SY+h3AjfxmVafelGc2oGhodCKRQXtCDycNuH/64EHkHjzqiBuj5lAGeSWOusD qijdmJvRo9tTEFwSq0sQGiPjeF6O1Uk1qsEht9esKEz5BdywhiLP/GZBhpXxX/XDBBM9 pw6nPzOXYt8OpqLu1ASybZQ0yrep10+PF9c673wPCcHJ4ntvqzhuoMjOCG4T+8BtfLXm dy5g== 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=TT+Qcc/VJgBle0he5ZuMesCmCwxXdxF1eJQi/8c4pT8=; b=CFDMpO11qxCCkXg4WYImu/5hrApeCrswf5M6yyNG4pYkOLxyDMtF23ETX4CpXJbaiF yF4ldyy5xIBqBOtcRAWj1F1oeWxpxIsLr/aKcuwf6c5seYWNCYBnj2N+g/s/03koQfEC sLJdlts6cV6kVK/f4Zf84uzvvqzSCcrU2B0S5K2ZeuhW34uw4JAm0sLJbhcti9pTV/bt +AQqM/2TdvRUSTYRuZZ6HNPBaZSVJpS0thgiE/eDehKjZ3NJ1JsuDAmtMrvMWf+xZuwb He3HZ97Q86Ds6Ij4ZR0m0tM1QYhRMBJITxGmmhmE4SsCxfFzzAG0yNF0MQf7eI/vJm7P mqHg== X-Gm-Message-State: AOPr4FUc8a4UnlL/OoRuc0NaGWbOlsKPbPtR7uhWXH2vykWs1XSTNOjFWNsEYcLQ2Zotsj6as74zZO40vAlZzg== MIME-Version: 1.0 X-Received: by 10.107.144.135 with SMTP id s129mr3361555iod.165.1461677271407; Tue, 26 Apr 2016 06:27:51 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.36.113.3 with HTTP; Tue, 26 Apr 2016 06:27:51 -0700 (PDT) In-Reply-To: References: <201604260440.u3Q4exZD045896@repo.freebsd.org> Date: Tue, 26 Apr 2016 06:27:51 -0700 X-Google-Sender-Auth: 0OMhj1-RCNf4MrAkwHd9hDv9sdY Message-ID: Subject: Re: svn commit: r298612 - head/sys/dev/iwm From: Adrian Chadd To: Ravi Pokala Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2016 13:27:52 -0000 it's a dirty habit I learnt from linux. Seeing the '!!' says "it's always 1 or 0". I get into that habit so the same thing happens when you do bit masking, eg: do_stop = (foo & 0x10) ; is 0x10 or 0, but do_stop = !! (foo & 0x10); is 1 or 0. -adrian On 25 April 2016 at 21:45, 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? > > -Ravi (rpokala@) > > > > -----Original Message----- > From: on behalf of Adrian Chadd > Date: 2016-04-25, Monday at 21:40 > To: , , > 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; >> >