Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7659283imu; Tue, 22 Jan 2019 09:24:54 -0800 (PST) X-Google-Smtp-Source: ALg8bN60xhcpyD6FzIVGO1G8v/nCs5zaiWaz6f6u6fq6zZg+vuLGLTKfo33RSHiKIWIRE0X79oGg X-Received: by 2002:a62:2fc3:: with SMTP id v186mr34419648pfv.82.1548177894342; Tue, 22 Jan 2019 09:24:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548177894; cv=none; d=google.com; s=arc-20160816; b=REgVdRTtmh6omAP6AJk3vTIF06LKsoI9fem/CByQZlvB7O3y1GCFlrjll9Fer4RaFf md0v9jMxbOFpxJYKmDsUEruMBT5wACiupkm/2UsSm+EnsNa63j/IyfTfzFZuNLW7Z3Md RJGgzI5rwyhomo9miaIUxIY+lziUQJCAVXe6+nTmK1KFGh94gzl/6sknpHJrtpV6gbDM yOsrjkczZGuLn+wS/No+14tRehnrX5HtTot1EDd/lFKglmgLLO5tsk8zhGYbCcDvUtjd OtbT9gvS5gRsGhqeO5xkQVhq6d9sIju3qGWpsu7JkjMzrObLOGt1+x+Zw5qhDOW0bU+P QzLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=95vT/g8JD1V7rlRm4ZraLcTyL7OUHKZsnDUXHLxwHqo=; b=sTBmTnExlfzlWWV8wPy4gmlk9pG6D7obqEi6ufTkXhoekZnfSRDz6Elym9J0aUNMUK qPtopymijwUSPtVeMAHXFdQ3kqek5pN861mwKRghIM9HsHj+KkP8deYT/o9yx3DYwzoU b0kySf1mi1lp5puJTYJx91zh6iyocTev9y4q832W5hMsetxEHg0W+V+hIqdZvt8BcCVr htlVqm3N/OVEXrxyvxrgoSJvhN4wRne7QPM4I+sw71ql2VN1427N6pakH6DKDcVt/+Ta fNnjugfZdXE5T1Is4jygqmkkyhfae6sBLQF3RPOI/780mUrylBBDyF48y29vsFh10ShV E0cA== 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 n20si1574159plp.294.2019.01.22.09.24.38; Tue, 22 Jan 2019 09:24:54 -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 S1729630AbfAVRXZ (ORCPT + 99 others); Tue, 22 Jan 2019 12:23:25 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:41162 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729385AbfAVRXV (ORCPT ); Tue, 22 Jan 2019 12:23:21 -0500 Received: by mail-lj1-f193.google.com with SMTP id k15-v6so21326784ljc.8; Tue, 22 Jan 2019 09:23:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=95vT/g8JD1V7rlRm4ZraLcTyL7OUHKZsnDUXHLxwHqo=; b=MYswCgPkx8yPLludpvoCz8WzQt5075xhaYI+fCU3BdwKEjIKqSoOjP2zJDqmufxyH/ 4eCsXK6ZSE9lyG1RuqYUmsicIcvuNlSc+zR6jqIuF2VE4XL3qR17Wz1EtX5o3oPHNu+H KiiV4/3MyhTvnGsJW6BG0wn+7/GOJvPzPwcLBmuxIJ0WIPUwTvaITmRyb6G9OtJU8Cym sPfDKfhJIKvud4FvFHti/f5byeJiM6ohynT34HxKXTmgWdd1fVIHvF/ix/lMv9ktMYo0 szNyHZNpwZ1h3JLPAT6WnvAKp/8Dzie8i74zs4DDMBfRlKFCzib9mZn6X7Rx21aERDX8 JuaA== X-Gm-Message-State: AJcUukdWz1nwkgVFvIAcni5WTGLDgjAcVAPmDzCSKzm2RPjMagrWTHWn Dw0ygThqU6sOhECeHzURPVbv33No X-Received: by 2002:a05:651c:c8:: with SMTP id 8mr21015706ljr.53.1548177799012; Tue, 22 Jan 2019 09:23:19 -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 z15-v6sm115050ljb.9.2019.01.22.09.23.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Jan 2019 09:23:17 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1glzla-0004gE-RE; Tue, 22 Jan 2019 18:23:14 +0100 From: Johan Hovold To: linux-kernel@vger.kernel.org Cc: Andreas Kemnade , Johan Hovold , stable Subject: [PATCH 1/3] gnss: sirf: fix premature wakeup interrupt enable Date: Tue, 22 Jan 2019 18:22:53 +0100 Message-Id: <20190122172255.17944-2-johan@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190122172255.17944-1-johan@kernel.org> References: <20190122172255.17944-1-johan@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make sure the receiver is powered (and booted) before enabling the wakeup interrupt to avoid spurious interrupts due to a floating input. Similarly, disable the interrupt before powering off on probe errors and on unbind. Fixes: d2efbbd18b1e ("gnss: add driver for sirfstar-based receivers") Cc: stable # 4.19 Signed-off-by: Johan Hovold --- drivers/gnss/sirf.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/drivers/gnss/sirf.c b/drivers/gnss/sirf.c index 226f6e6fe01b..8e3f6a776e02 100644 --- a/drivers/gnss/sirf.c +++ b/drivers/gnss/sirf.c @@ -310,30 +310,26 @@ static int sirf_probe(struct serdev_device *serdev) ret = -ENODEV; goto err_put_device; } + + ret = regulator_enable(data->vcc); + if (ret) + goto err_put_device; + + /* Wait for chip to boot into hibernate mode. */ + msleep(SIRF_BOOT_DELAY); } if (data->wakeup) { ret = gpiod_to_irq(data->wakeup); if (ret < 0) - goto err_put_device; - + goto err_disable_vcc; data->irq = ret; - ret = devm_request_threaded_irq(dev, data->irq, NULL, - sirf_wakeup_handler, + ret = request_threaded_irq(data->irq, NULL, sirf_wakeup_handler, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, "wakeup", data); if (ret) - goto err_put_device; - } - - if (data->on_off) { - ret = regulator_enable(data->vcc); - if (ret) - goto err_put_device; - - /* Wait for chip to boot into hibernate mode */ - msleep(SIRF_BOOT_DELAY); + goto err_disable_vcc; } if (IS_ENABLED(CONFIG_PM)) { @@ -342,7 +338,7 @@ static int sirf_probe(struct serdev_device *serdev) } else { ret = sirf_runtime_resume(dev); if (ret < 0) - goto err_disable_vcc; + goto err_free_irq; } ret = gnss_register_device(gdev); @@ -356,6 +352,9 @@ static int sirf_probe(struct serdev_device *serdev) pm_runtime_disable(dev); else sirf_runtime_suspend(dev); +err_free_irq: + if (data->wakeup) + free_irq(data->irq, data); err_disable_vcc: if (data->on_off) regulator_disable(data->vcc); @@ -376,6 +375,9 @@ static void sirf_remove(struct serdev_device *serdev) else sirf_runtime_suspend(&serdev->dev); + if (data->wakeup) + free_irq(data->irq, data); + if (data->on_off) regulator_disable(data->vcc); -- 2.20.1