Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp526946imu; Fri, 25 Jan 2019 06:32:30 -0800 (PST) X-Google-Smtp-Source: ALg8bN4mPEul9QFxccltIqIrJT7meU6vXTj6A2pAKnjdN4ydDB6NoISBdVr1RGG6VfChPm4jb+IY X-Received: by 2002:a62:5444:: with SMTP id i65mr11540980pfb.193.1548426750554; Fri, 25 Jan 2019 06:32:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548426750; cv=none; d=google.com; s=arc-20160816; b=TjTPUtmQnD2orGad5eysX+vgTi+xLvBDtA1vAbcOQ/GISXA3iWUcopVs6GggzRz/6K EzeuTyXUj6Rnny8MlIU+8z2FkpYPe652jvZbwcU1SV8NVAp048/zGFy/eM8v04rFTuzo QDG01btLZKAuti5U3cWod3r7tZcl9Y2KCC4v0DI6vLTuyIkW6BpwnkOmD7mvFmw+90AY E3az+hTxU6edVqrUP/iPSagaj7QzQGnPYtF84+W4/IYfz9ULsxzQVNb5rxU6bs9cq+1f m08YaHfoC5rEb/950TVNr1JLJKwTOm2HTelEGxKMHj7JRMd+J/cU0S/lcQQxLibsttZp XBZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=bl28olHm22WN+bFTT+3YDy6j2/Cl90eudWoGeWUh7WI=; b=EFF3GtB9hVqtYV4Xb9ZEc7+eKoJ/jUHLvH91JrjMF1rRQDadsbiGp6cpzvHYH73j0F ZG+ZuWDb0YOU054TkfZbxiTf/xixHxg8UKv7Aqzwb8c+DdHF30IKRYjMIq9sCWUpDORQ 5v6zuEgPpOfIhPWFoEY2nJc/3NVBwvKgo6SGGTdgKGCJ1+gSZbwdeO7/b8CY3xNSW8yz f8bDMI25geNLPbcfZSbBV/HDbkgq3mUXw4185NAtl2sgu4G/U+iCvEFYxwVQmfXFwl86 qVb/5pb/c3FJh5Zgn2JLRI/DwjiL6ep8xv/mWLlRYCkE9L7948gslJFnKmYldt5LF7NN QMCA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t65si25676430pfb.247.2019.01.25.06.32.15; Fri, 25 Jan 2019 06:32:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727264AbfAYOcB (ORCPT + 99 others); Fri, 25 Jan 2019 09:32:01 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:40723 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726122AbfAYOcA (ORCPT ); Fri, 25 Jan 2019 09:32:00 -0500 Received: by mail-lj1-f193.google.com with SMTP id n18-v6so8529586lji.7; Fri, 25 Jan 2019 06:31:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=bl28olHm22WN+bFTT+3YDy6j2/Cl90eudWoGeWUh7WI=; b=fWjscYHRd3PuHxUgFCJ0ujiNpw2RmSp8YtsCe99rOcoyRJ+4VdlOCCzGxhEF+51ksX v1JVvgPXSjE4i4M9vqH9zStVpTJ2jdGAACK42dlL57avHXhEXTOteawvxHBMll2OT3wX JFTyTUYlNazfFCrVOzhkfHVoAQYrwqBohFAofHlioKeWVzuKOoWo2FRAkVi6gyfLCnxX OPAKzxXECxc4i8dc6wT9bLePToq+3L2WXJ8ccruAUxTijXSALSxsrqstVDSoS+u2S5hX ZbwGYUxoHYnwK+zyEdO38PunmoL5Me652CwBm7OxPDVLhNxoqcUC+Q8gxrXiaJ6sj3tT /gvA== X-Gm-Message-State: AJcUukeN1GwjhKDFJJYHjEuuYYT/22nH7WngvJnmDOYnSfIKes3G1d7V 8fF+QWOCtg6mhaf/XlEUHCI= X-Received: by 2002:a2e:5854:: with SMTP id x20-v6mr9166456ljd.31.1548426718000; Fri, 25 Jan 2019 06:31:58 -0800 (PST) Received: from xi.terra (c-74bee655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.190.116]) by smtp.gmail.com with ESMTPSA id m12sm1483761lfc.30.2019.01.25.06.31.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Jan 2019 06:31:57 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1gn2WP-0005zu-Es; Fri, 25 Jan 2019 15:31:53 +0100 Date: Fri, 25 Jan 2019 15:31:53 +0100 From: Johan Hovold To: Andreas Kemnade Cc: letux-kernel@openphoenux.org, johan@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 2/5] gnss: sirf: add support for configurations without wakeup signal Message-ID: <20190125143153.GF3691@localhost> References: <20190124063439.29897-1-andreas@kemnade.info> <20190124063439.29897-3-andreas@kemnade.info> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190124063439.29897-3-andreas@kemnade.info> User-Agent: Mutt/1.11.2 (2019-01-07) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 24, 2019 at 07:34:36AM +0100, Andreas Kemnade wrote: > Some Wi2Wi devices do not have a wakeup output, so device state can > only be indirectly detected by looking whether there is communication > over the serial lines. > This approach requires a report cycle set to a value less than 2 seconds > to be reliable. > > Signed-off-by: Andreas Kemnade > --- > Changes in v4: > - was 3/6 earlier > - more cleanup > - separate no wakeup version for sirf_wait_for_power_state > - cleaned up optimisation for initial power off > > Changes in v3: > - was 2/5 earlier > - changed commit headline > - more style cleanup > - split out initial power off as 2/6 > - introduced SIRF_REPORT_CYCLE constant > - added documentation about limitations > - ignore first data after power state on so no > shutdown meassages are treated as power on success > - clearer logic in sirf_wait_for_power_state > > Changes in v2: > - style cleanup > - do not keep serdev open just because runtime is active, > only when needed (gnss device is opened or state is changed) > - clearer timeout semantics > > drivers/gnss/sirf.c | 124 ++++++++++++++++++++++++++++++++++++++++++++-------- > 1 file changed, 105 insertions(+), 19 deletions(-) > static int sirf_wait_for_power_state(struct sirf_data *data, bool active, > unsigned long timeout) > { > int ret; > > + if (!data->wakeup) > + return sirf_wait_for_power_state_nowakeup(data, active, > + timeout); > + > ret = wait_event_interruptible_timeout(data->power_wait, > data->active == active, msecs_to_jiffies(timeout)); > if (ret < 0) > @@ -195,6 +267,12 @@ static int sirf_set_active(struct sirf_data *data, bool active) > else > timeout = SIRF_HIBERNATE_TIMEOUT; > > + if (!data->wakeup) { > + ret = sirf_serdev_open(data); > + if (ret) > + return ret; > + } > + > do { > sirf_pulse_on_off(data); > ret = sirf_wait_for_power_state(data, active, timeout); > @@ -202,12 +280,17 @@ static int sirf_set_active(struct sirf_data *data, bool active) > if (ret == -ETIMEDOUT) > continue; > > - return ret; > } > - > break; > + > } while (retries--); I noticed there were some odd white-space changes here after you reverted the modified error handling from v3 which initially looked a little out of place to me. I decided to add those changed back in instead after looking at the end result and noticing that the (retries < 0) check below also becomes superfluous. > + if (!data->wakeup) > + sirf_serdev_close(data); > + > + if (ret) > + return ret; > + > if (retries < 0) > return -ETIMEDOUT; Series now applied, good job! Johan