All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: linux-watchdog@vger.kernel.org, Wim Van Sebroeck <wim@iguana.be>
Cc: Lokesh Vutla <lokeshvutla@ti.com>, Felipe Balbi <balbi@ti.com>,
	kernel@pengutronix.de
Subject: [PATCH 3/3] watchdog: omap: simplify assignment of bootstatus
Date: Fri, 24 Apr 2015 11:48:33 +0200	[thread overview]
Message-ID: <1429868913-24049-4-git-send-email-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <1429868913-24049-1-git-send-email-u.kleine-koenig@pengutronix.de>

Instead of using an over-long expression involving the ?: operator use
an if and intead of an else branch rely on the fact that the data
structure was allocated using devm_kzalloc. This also allows to put the
used helper variable into a more local scope.

There is no functional change.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/watchdog/omap_wdt.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index 479e7c8e44f5..0421c06a6cf0 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -209,7 +209,6 @@ static int omap_wdt_probe(struct platform_device *pdev)
 	struct omap_wd_timer_platform_data *pdata = dev_get_platdata(&pdev->dev);
 	struct resource *res;
 	struct omap_wdt_dev *wdev;
-	u32 rs;
 	int ret;
 
 	wdev = devm_kzalloc(&pdev->dev, sizeof(*wdev), GFP_KERNEL);
@@ -242,12 +241,11 @@ static int omap_wdt_probe(struct platform_device *pdev)
 	pm_runtime_enable(wdev->dev);
 	pm_runtime_get_sync(wdev->dev);
 
-	if (pdata && pdata->read_reset_sources)
-		rs = pdata->read_reset_sources();
-	else
-		rs = 0;
-	wdev->wdog.bootstatus = (rs & (1 << OMAP_MPU_WD_RST_SRC_ID_SHIFT)) ?
-		WDIOF_CARDRESET : 0;
+	if (pdata && pdata->read_reset_sources) {
+		u32 rs = pdata->read_reset_sources();
+		if (rs & (1 << OMAP_MPU_WD_RST_SRC_ID_SHIFT))
+			wdev->wdog.bootstatus = WDIOF_CARDRESET;
+	}
 
 	omap_wdt_disable(wdev);
 
-- 
2.1.4


  parent reply	other threads:[~2015-04-24  9:48 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-24  9:48 [PATCH 0/3] watchdog: omap: several cleanups Uwe Kleine-König
2015-04-24  9:48 ` [PATCH 1/3] watchdog: omap: use watchdog_init_timeout Uwe Kleine-König
2015-04-24 14:42   ` Felipe Balbi
2015-04-24 14:42     ` Felipe Balbi
2015-04-24 19:02     ` Uwe Kleine-König
2015-04-24 19:02       ` Uwe Kleine-König
2015-04-24 20:20       ` [PATCH 1a/3] watchdog: omap: clearify device tree documentation Uwe Kleine-König
2015-04-24 20:20         ` Uwe Kleine-König
2015-04-25  2:10         ` Felipe Balbi
2015-04-25  2:10           ` Felipe Balbi
2015-04-26 15:29           ` Guenter Roeck
2015-04-26 15:29             ` Guenter Roeck
2015-04-26 19:12             ` Uwe Kleine-König
2015-04-26 19:12               ` Uwe Kleine-König
2015-04-26 19:46               ` Guenter Roeck
2015-04-26 19:46                 ` Guenter Roeck
2015-04-24  9:48 ` [PATCH 2/3] watchdog: omap: put struct watchdog_device into driver data Uwe Kleine-König
2015-04-24 14:44   ` Felipe Balbi
2015-04-24 14:44     ` Felipe Balbi
2015-04-24 19:10     ` Uwe Kleine-König
2015-04-24 19:10       ` Uwe Kleine-König
2015-04-24  9:48 ` Uwe Kleine-König [this message]
2015-04-24 14:45   ` [PATCH 3/3] watchdog: omap: simplify assignment of bootstatus Felipe Balbi
2015-04-24 14:45     ` Felipe Balbi
2015-04-24 19:03   ` Uwe Kleine-König
2015-04-26 15:28     ` Guenter Roeck
2015-04-26 19:14       ` Uwe Kleine-König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1429868913-24049-4-git-send-email-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=balbi@ti.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=lokeshvutla@ti.com \
    --cc=wim@iguana.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.