Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4920920ybv; Wed, 26 Feb 2020 05:21:49 -0800 (PST) X-Google-Smtp-Source: APXvYqyiYszzuJAaBKD7KvY2sUDuYLE4o3yRZf/e4y7JzTX0MjCfU6OnljL89ZZSjZoPabjDpFlj X-Received: by 2002:a05:6808:487:: with SMTP id z7mr3096516oid.59.1582723309617; Wed, 26 Feb 2020 05:21:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582723309; cv=none; d=google.com; s=arc-20160816; b=wouFnwhoDcxqTStatTRDhWnt+qqJe2ayIe2w/COsc1vii/NrtgX6wrlv2bUL5QJeMH ma64V2TDSa4OUV+A4YOFH9xxdqyJyOZo9saW04MWW1KksV4doWGjpkeGOVdtQ69exmC0 IqmmG7vGtgOKNCUXHjaS1h4plLHB5P16dh78DDEs+B4XDNYge7TMYighrI8YIi8ME1A6 G8v0Zntx8XxXmr/qaoTZmPq63N/v4dDFfAGND2cJz9w/e1vqDjLHpcTh5N6EaSG7wTfD Wx2iJ9Pbnmt4gfCLs6MfAhg6blojr0MAuNWOwoK0Hhyl9ljjJ/qP6ObpWmSUz7ZCo2jJ CBmw== 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=TQwk5C8Qlsxe7HH3tqxKYeRG6+8YSDb3TBPETEdNtDU=; b=puSIEEjK1MuW4OBItm9+1MgviY8lPNN5ot2lm2KcxAdEmSGqcqj25GvdYv71+4PdjP 7It18AaWospr7svqL2s0h6TH5teO75+fZ2N5LLmRKCOwsScRBoZz/26HY6Drgr/YKscM 7fkI3zGstBe51eXdPD+JFWHV9gsPdunW/N2mLP8Bo74IUyRTAAK9L/+6INLFmZEnzg0h JDfkmNWNBAliW3lfZY99haM2TeuQPwtuAJ4tlTFSF27N9IP6yw3W4s6yXkxCV8QVbXEC fCqZq7LXYXA+6u7NUUTBrDzQhvyn6gmADUtRM673CGU8RN7djWqN6SiWs+b15HjOLQZQ x+tw== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o20si1265772ota.17.2020.02.26.05.21.37; Wed, 26 Feb 2020 05:21:49 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727108AbgBZNV3 (ORCPT + 99 others); Wed, 26 Feb 2020 08:21:29 -0500 Received: from mga06.intel.com ([134.134.136.31]:39882 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726892AbgBZNV2 (ORCPT ); Wed, 26 Feb 2020 08:21:28 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Feb 2020 05:21:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,488,1574150400"; d="scan'208";a="231395659" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 26 Feb 2020 05:21:23 -0800 Received: by black.fi.intel.com (Postfix, from userid 1001) id AC008418; Wed, 26 Feb 2020 15:21:22 +0200 (EET) From: Mika Westerberg To: Guenter Roeck , Jean Delvare , Wim Van Sebroeck , Wolfram Sang Cc: Martin Volf , Andy Shevchenko , Jarkko Nikula , Mika Westerberg , linux-i2c@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/3] watchdog: iTCO_wdt: Make ICH_RES_IO_SMI optional Date: Wed, 26 Feb 2020 16:21:21 +0300 Message-Id: <20200226132122.62805-3-mika.westerberg@linux.intel.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200226132122.62805-1-mika.westerberg@linux.intel.com> References: <20200226132122.62805-1-mika.westerberg@linux.intel.com> 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 The iTCO_wdt driver only needs ICH_RES_IO_SMI I/O resource when either turn_SMI_watchdog_clear_off module parameter is set to match ->iTCO_version (or higher), and when legacy iTCO_vendorsupport is set. Modify the driver so that ICH_RES_IO_SMI is optional if the two conditions are not met. Signed-off-by: Mika Westerberg --- drivers/watchdog/iTCO_wdt.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c index 156360e37714..e707c4797f76 100644 --- a/drivers/watchdog/iTCO_wdt.c +++ b/drivers/watchdog/iTCO_wdt.c @@ -459,13 +459,25 @@ static int iTCO_wdt_probe(struct platform_device *pdev) if (!p->tco_res) return -ENODEV; - p->smi_res = platform_get_resource(pdev, IORESOURCE_IO, ICH_RES_IO_SMI); - if (!p->smi_res) - return -ENODEV; - p->iTCO_version = pdata->version; p->pci_dev = to_pci_dev(dev->parent); + p->smi_res = platform_get_resource(pdev, IORESOURCE_IO, ICH_RES_IO_SMI); + if (p->smi_res) { + /* The TCO logic uses the TCO_EN bit in the SMI_EN register */ + if (!devm_request_region(dev, p->smi_res->start, + resource_size(p->smi_res), + pdev->name)) { + pr_err("I/O address 0x%04llx already in use, device disabled\n", + (u64)SMI_EN(p)); + return -EBUSY; + } + } else if (iTCO_vendorsupport || + turn_SMI_watchdog_clear_off >= p->iTCO_version) { + pr_err("SMI I/O resource is missing\n"); + return -ENODEV; + } + iTCO_wdt_no_reboot_bit_setup(p, pdata); /* @@ -492,14 +504,6 @@ static int iTCO_wdt_probe(struct platform_device *pdev) /* Set the NO_REBOOT bit to prevent later reboots, just for sure */ p->update_no_reboot_bit(p->no_reboot_priv, true); - /* The TCO logic uses the TCO_EN bit in the SMI_EN register */ - if (!devm_request_region(dev, p->smi_res->start, - resource_size(p->smi_res), - pdev->name)) { - pr_err("I/O address 0x%04llx already in use, device disabled\n", - (u64)SMI_EN(p)); - return -EBUSY; - } if (turn_SMI_watchdog_clear_off >= p->iTCO_version) { /* * Bit 13: TCO_EN -> 0 -- 2.25.0