Skip to content

Commit e42b0c2

Browse files
westeriWolfram Sang
authored andcommitted
watchdog: iTCO_wdt: Make ICH_RES_IO_SMI optional
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 <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 7ca6ee3 commit e42b0c2

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

drivers/watchdog/iTCO_wdt.c

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -459,13 +459,25 @@ static int iTCO_wdt_probe(struct platform_device *pdev)
459459
if (!p->tco_res)
460460
return -ENODEV;
461461

462-
p->smi_res = platform_get_resource(pdev, IORESOURCE_IO, ICH_RES_IO_SMI);
463-
if (!p->smi_res)
464-
return -ENODEV;
465-
466462
p->iTCO_version = pdata->version;
467463
p->pci_dev = to_pci_dev(dev->parent);
468464

465+
p->smi_res = platform_get_resource(pdev, IORESOURCE_IO, ICH_RES_IO_SMI);
466+
if (p->smi_res) {
467+
/* The TCO logic uses the TCO_EN bit in the SMI_EN register */
468+
if (!devm_request_region(dev, p->smi_res->start,
469+
resource_size(p->smi_res),
470+
pdev->name)) {
471+
pr_err("I/O address 0x%04llx already in use, device disabled\n",
472+
(u64)SMI_EN(p));
473+
return -EBUSY;
474+
}
475+
} else if (iTCO_vendorsupport ||
476+
turn_SMI_watchdog_clear_off >= p->iTCO_version) {
477+
pr_err("SMI I/O resource is missing\n");
478+
return -ENODEV;
479+
}
480+
469481
iTCO_wdt_no_reboot_bit_setup(p, pdata);
470482

471483
/*
@@ -492,14 +504,6 @@ static int iTCO_wdt_probe(struct platform_device *pdev)
492504
/* Set the NO_REBOOT bit to prevent later reboots, just for sure */
493505
p->update_no_reboot_bit(p->no_reboot_priv, true);
494506

495-
/* The TCO logic uses the TCO_EN bit in the SMI_EN register */
496-
if (!devm_request_region(dev, p->smi_res->start,
497-
resource_size(p->smi_res),
498-
pdev->name)) {
499-
pr_err("I/O address 0x%04llx already in use, device disabled\n",
500-
(u64)SMI_EN(p));
501-
return -EBUSY;
502-
}
503507
if (turn_SMI_watchdog_clear_off >= p->iTCO_version) {
504508
/*
505509
* Bit 13: TCO_EN -> 0

0 commit comments

Comments
 (0)