Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp277322lqs; Thu, 13 Jun 2024 09:43:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWRuLJ0GczucFes223oW5MNcCcqMgJTEK2jcOWL6M3ufjDEE8OuaXDJlUMkWuhE0SHf60agAZ41mzqbsHM7I5CmwmTNBQKSWk5QFlIN7g== X-Google-Smtp-Source: AGHT+IF7/68AMrSquyWvfbZ4KlrXStenFGhnNXhq4U+GCUMO6HQBUlVUqKl32TZHHRCu2zAv1iIe X-Received: by 2002:a2e:2e0f:0:b0:2eb:fc08:5d83 with SMTP id 38308e7fff4ca-2ec0e5abd60mr2384641fa.44.1718296979867; Thu, 13 Jun 2024 09:42:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718296979; cv=pass; d=google.com; s=arc-20160816; b=NDUhLPJoaQ/0QA6wvNarQdHf+mgblA0OsvgTN8NkVjhVcs8IlRcKFz4/35AoGfHBSD LCyRAhw8z5DQtUXAtr3nWW/l5pgGtbuHE/eqmqjbi3fYjGUgFjtclgPqpC/ZIw0UpKlt b5ELTGeogqJ7ZjnLP82mD9pgPeCl1uvlIZrmguwBWm0yGsQmZdl0ZxG/xeHdOxdgmL2B Y5XaApKAk6wbw4NCpYSinjAnbvi9UAaG7WIF7OWxyNoMFzt+sP+aoZ+suBqCcq16bUxV 9My6tbFr3vHmjQMUAAR2oMxY7KPw8dJsChdk/rUZMGTZ8/BWeN+3pk/KGvE70WTX1W1k 4xMw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=4dJR3hHbvgKmOl5sUDZdsAffIZFQ6lBPh0rzTj8sNRs=; fh=JoSNs3lxvIAe2uLLfEpWfsBQf2kLm6EJVyAeLD3qpDw=; b=AkdTn55AyKxcInCiGjQHetXyoNaeG0zm44zQbuqvKerb+505HfcMXheu7C5JISiXWE BrdiAHXs3msZBg4behXBzdakhUQJzG2pSwi7BRAGou9av1cydTxa0psJIopOzAIbe7nk fuApLRC0TQ/hX3NcMuPPMZC1JdPX84k7/ozV5EMzPb0bIyZdN8/jo5s2FwmVRbm1YZqf 0TgpnAZ0OWkjhIf5wBYedMA1EK7YUF1NiBDx+tqwTcY+YAqssZGNK0PckFq+CMemNanS XA8nsIxJetJj0ZzruZ5OZwVzl5acv2u+lMAcm6rdXpsiv03UsnCW8SjNu+oxAZuL6mt8 HUgg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=hqJIAeaq; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-213664-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213664-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57cb72d65f7si923543a12.119.2024.06.13.09.42.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 09:42:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213664-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=hqJIAeaq; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-213664-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213664-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 2026B1F21870 for ; Thu, 13 Jun 2024 16:42:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5FBBE1487DF; Thu, 13 Jun 2024 16:42:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="hqJIAeaq" Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A67D51494D1; Thu, 13 Jun 2024 16:42:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718296952; cv=none; b=HuHc988/JI7R94NT498hDH0lyGqTfYoLx4Du+FMzKH284H6a1XASkWQjjs3wfi9uDrSvOuajz2Kb/kNjGEcnkORM5W0Xqtb3oxFQJoEoahysfmOmHqqEKWcZaTyLkiTpJk3J5oR12hDyd2X6O1MVpn6oNqgQX2Q0EJmVH4QAOEo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718296952; c=relaxed/simple; bh=Rwt9PdDlBPU1Mtk8I78hJCVMn23gkkE1PpUlz0qmemU=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=cDOJiFy4/FRVOVVKYtFxeFM8uorFTLXP+pV/HgEkVCHnTU1zLUiHzBvZ10gSuaMNSXgq8BU5Xqk9ZZBww+gJQLiRxrCoawnfys6wtxsaXYkzSW3Qwnt508f+aYVKPRToleWZ5AGVSnCVagIHtP1lHt/gG5AYZvtEyRRYZSmi+t0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=hqJIAeaq; arc=none smtp.client-ip=217.70.183.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 63AF2FF806; Thu, 13 Jun 2024 16:42:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1718296942; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=4dJR3hHbvgKmOl5sUDZdsAffIZFQ6lBPh0rzTj8sNRs=; b=hqJIAeaqOGMgsL2S+VuFTO8+j4NW7CjsmyX26xsMZdv4kQdapRvADPzBTIBGaU1ZsGWI19 od+G7uXc9+Nd1sHNGsr5Ck77HElrJqF7nek+xBxiGYVRTwC532NwufMKnFBhGmH5wFh2A6 MCEZA31gAoBan5ilW75Kv/3h1iJatr7z/Mad283QjSGMMBIYlS80HsaZzz2BtBAgW4S1cl TGm+iqZpaqt1F2MKT6HktF9/zm4J2ZXrBdFCn5efLHuotbPxcu8h9LrOPBD5kn4KwT+G2Z jOF9RknNfjZuAxfWN0ffW4RCNNGyhieuHzmdUVi+E7s5Vh1FTr0tIm+6q5U2aw== From: Thomas Richard To: wim@linux-watchdog.org, linux@roeck-us.net Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, michael.brunner@kontron.com, thomas.richard@bootlin.com, thomas.petazzoni@bootlin.com Subject: [PATCH] watchdog: kempld: use pretimeout member of watchdog_device struct Date: Thu, 13 Jun 2024 18:41:57 +0200 Message-Id: <20240613164157.457693-1-thomas.richard@bootlin.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: thomas.richard@bootlin.com Th driver was written whereas pretimeout wasn't supported by the watchdog core. So the pretimeout was stored in the driver data. Now the core has pretimeout support, so use it. Signed-off-by: Thomas Richard --- drivers/watchdog/kempld_wdt.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/watchdog/kempld_wdt.c b/drivers/watchdog/kempld_wdt.c index e6c7a2906680..ebb873502203 100644 --- a/drivers/watchdog/kempld_wdt.c +++ b/drivers/watchdog/kempld_wdt.c @@ -73,7 +73,6 @@ struct kempld_wdt_stage { struct kempld_wdt_data { struct kempld_device_data *pld; struct watchdog_device wdd; - unsigned int pretimeout; struct kempld_wdt_stage stage[KEMPLD_WDT_MAX_STAGES]; u8 pm_status_store; }; @@ -205,8 +204,8 @@ static int kempld_wdt_set_timeout(struct watchdog_device *wdd, timeout_stage = &wdt_data->stage[STAGE_TIMEOUT]; pretimeout_stage = &wdt_data->stage[STAGE_PRETIMEOUT]; - if (pretimeout_stage->mask && wdt_data->pretimeout > 0) - timeout = wdt_data->pretimeout; + if (pretimeout_stage->mask && wdd->pretimeout > 0) + timeout = wdd->pretimeout; ret = kempld_wdt_set_stage_action(wdt_data, timeout_stage, ACTION_RESET); @@ -249,13 +248,14 @@ static int kempld_wdt_set_pretimeout(struct watchdog_device *wdd, if (ret) return ret; - wdt_data->pretimeout = pretimeout; + wdd->pretimeout = pretimeout; return 0; } static void kempld_wdt_update_timeouts(struct kempld_wdt_data *wdt_data) { struct kempld_device_data *pld = wdt_data->pld; + struct watchdog_device *wdd = &wdt_data->wdd; struct kempld_wdt_stage *pretimeout_stage; struct kempld_wdt_stage *timeout_stage; unsigned int pretimeout, timeout; @@ -269,11 +269,11 @@ static void kempld_wdt_update_timeouts(struct kempld_wdt_data *wdt_data) kempld_release_mutex(pld); if (pretimeout) - wdt_data->pretimeout = timeout; + wdd->pretimeout = timeout; else - wdt_data->pretimeout = 0; + wdd->pretimeout = 0; - wdt_data->wdd.timeout = pretimeout + timeout; + wdd->timeout = pretimeout + timeout; } static int kempld_wdt_start(struct watchdog_device *wdd) @@ -336,7 +336,6 @@ static int kempld_wdt_keepalive(struct watchdog_device *wdd) static long kempld_wdt_ioctl(struct watchdog_device *wdd, unsigned int cmd, unsigned long arg) { - struct kempld_wdt_data *wdt_data = watchdog_get_drvdata(wdd); void __user *argp = (void __user *)arg; int ret = -ENOIOCTLCMD; int __user *p = argp; @@ -352,7 +351,7 @@ static long kempld_wdt_ioctl(struct watchdog_device *wdd, unsigned int cmd, ret = kempld_wdt_keepalive(wdd); break; case WDIOC_GETPRETIMEOUT: - ret = put_user(wdt_data->pretimeout, (int __user *)arg); + ret = put_user(wdd->pretimeout, (int __user *)arg); break; } -- 2.39.2