[PATCH v2 1/8] watchdog: watchdog_dev: Use single variable name for struct watchdog_device
The current code uses 'wdd', wddev', and 'watchdog' as variable names for struct watchdog_device. This is confusing and makes it difficult to enhance the code. Replace it all with 'wdd'. Cc: Timo Kokkonen Cc: Uwe Kleine-König Acked-by: Uwe Kleine-König Signed-off-by: Guenter Roeck --- v2: No changes --- drivers/watchdog/watchdog_dev.c | 151 1 file changed, 75 insertions(+), 76 deletions(-) diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c index 6aaefbad303e..06171c73daf5 100644 --- a/drivers/watchdog/watchdog_dev.c +++ b/drivers/watchdog/watchdog_dev.c @@ -51,7 +51,7 @@ static struct watchdog_device *old_wdd; /* * watchdog_ping: ping the watchdog. - * @wddev: the watchdog device to ping + * @wdd: the watchdog device to ping * * If the watchdog has no own ping operation then it needs to be * restarted via the start operation. This wrapper function does @@ -59,65 +59,65 @@ static struct watchdog_device *old_wdd; * We only ping when the watchdog device is running. */ -static int watchdog_ping(struct watchdog_device *wddev) +static int watchdog_ping(struct watchdog_device *wdd) { int err = 0; - mutex_lock(>lock); + mutex_lock(>lock); - if (test_bit(WDOG_UNREGISTERED, >status)) { + if (test_bit(WDOG_UNREGISTERED, >status)) { err = -ENODEV; goto out_ping; } - if (!watchdog_active(wddev)) + if (!watchdog_active(wdd)) goto out_ping; - if (wddev->ops->ping) - err = wddev->ops->ping(wddev); /* ping the watchdog */ + if (wdd->ops->ping) + err = wdd->ops->ping(wdd); /* ping the watchdog */ else - err = wddev->ops->start(wddev); /* restart watchdog */ + err = wdd->ops->start(wdd); /* restart watchdog */ out_ping: - mutex_unlock(>lock); + mutex_unlock(>lock); return err; } /* * watchdog_start: wrapper to start the watchdog. - * @wddev: the watchdog device to start + * @wdd: the watchdog device to start * * Start the watchdog if it is not active and mark it active. * This function returns zero on success or a negative errno code for * failure. */ -static int watchdog_start(struct watchdog_device *wddev) +static int watchdog_start(struct watchdog_device *wdd) { int err = 0; - mutex_lock(>lock); + mutex_lock(>lock); - if (test_bit(WDOG_UNREGISTERED, >status)) { + if (test_bit(WDOG_UNREGISTERED, >status)) { err = -ENODEV; goto out_start; } - if (watchdog_active(wddev)) + if (watchdog_active(wdd)) goto out_start; - err = wddev->ops->start(wddev); + err = wdd->ops->start(wdd); if (err == 0) - set_bit(WDOG_ACTIVE, >status); + set_bit(WDOG_ACTIVE, >status); out_start: - mutex_unlock(>lock); + mutex_unlock(>lock); return err; } /* * watchdog_stop: wrapper to stop the watchdog. - * @wddev: the watchdog device to stop + * @wdd: the watchdog device to stop * * Stop the watchdog if it is still active and unmark it active. * This function returns zero on success or a negative errno code for @@ -125,155 +125,154 @@ out_start: * If the 'nowayout' feature was set, the watchdog cannot be stopped. */ -static int watchdog_stop(struct watchdog_device *wddev) +static int watchdog_stop(struct watchdog_device *wdd) { int err = 0; - mutex_lock(>lock); + mutex_lock(>lock); - if (test_bit(WDOG_UNREGISTERED, >status)) { + if (test_bit(WDOG_UNREGISTERED, >status)) { err = -ENODEV; goto out_stop; } - if (!watchdog_active(wddev)) + if (!watchdog_active(wdd)) goto out_stop; - if (test_bit(WDOG_NO_WAY_OUT, >status)) { - dev_info(wddev->dev, "nowayout prevents watchdog being stopped!\n"); + if (test_bit(WDOG_NO_WAY_OUT, >status)) { + dev_info(wdd->dev, "nowayout prevents watchdog being stopped!\n"); err = -EBUSY; goto out_stop; } - err = wddev->ops->stop(wddev); + err = wdd->ops->stop(wdd); if (err == 0) - clear_bit(WDOG_ACTIVE, >status); + clear_bit(WDOG_ACTIVE, >status); out_stop: - mutex_unlock(>lock); + mutex_unlock(>lock); return err; } /* * watchdog_get_status: wrapper to get the watchdog status - * @wddev: the watchdog device to get the status from + * @wdd: the watchdog device to get the status from * @status: the status of the watchdog device * * Get the watchdog's status flags. */ -static int watchdog_get_status(struct watchdog_device *wddev, +static int
[PATCH v2 1/8] watchdog: watchdog_dev: Use single variable name for struct watchdog_device
The current code uses 'wdd', wddev', and 'watchdog' as variable names for struct watchdog_device. This is confusing and makes it difficult to enhance the code. Replace it all with 'wdd'. Cc: Timo Kokkonen timo.kokko...@offcode.fi Cc: Uwe Kleine-König u.kleine-koe...@pengutronix.de Acked-by: Uwe Kleine-König u.kleine-koe...@pengutronix.de Signed-off-by: Guenter Roeck li...@roeck-us.net --- v2: No changes --- drivers/watchdog/watchdog_dev.c | 151 1 file changed, 75 insertions(+), 76 deletions(-) diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c index 6aaefbad303e..06171c73daf5 100644 --- a/drivers/watchdog/watchdog_dev.c +++ b/drivers/watchdog/watchdog_dev.c @@ -51,7 +51,7 @@ static struct watchdog_device *old_wdd; /* * watchdog_ping: ping the watchdog. - * @wddev: the watchdog device to ping + * @wdd: the watchdog device to ping * * If the watchdog has no own ping operation then it needs to be * restarted via the start operation. This wrapper function does @@ -59,65 +59,65 @@ static struct watchdog_device *old_wdd; * We only ping when the watchdog device is running. */ -static int watchdog_ping(struct watchdog_device *wddev) +static int watchdog_ping(struct watchdog_device *wdd) { int err = 0; - mutex_lock(wddev-lock); + mutex_lock(wdd-lock); - if (test_bit(WDOG_UNREGISTERED, wddev-status)) { + if (test_bit(WDOG_UNREGISTERED, wdd-status)) { err = -ENODEV; goto out_ping; } - if (!watchdog_active(wddev)) + if (!watchdog_active(wdd)) goto out_ping; - if (wddev-ops-ping) - err = wddev-ops-ping(wddev); /* ping the watchdog */ + if (wdd-ops-ping) + err = wdd-ops-ping(wdd); /* ping the watchdog */ else - err = wddev-ops-start(wddev); /* restart watchdog */ + err = wdd-ops-start(wdd); /* restart watchdog */ out_ping: - mutex_unlock(wddev-lock); + mutex_unlock(wdd-lock); return err; } /* * watchdog_start: wrapper to start the watchdog. - * @wddev: the watchdog device to start + * @wdd: the watchdog device to start * * Start the watchdog if it is not active and mark it active. * This function returns zero on success or a negative errno code for * failure. */ -static int watchdog_start(struct watchdog_device *wddev) +static int watchdog_start(struct watchdog_device *wdd) { int err = 0; - mutex_lock(wddev-lock); + mutex_lock(wdd-lock); - if (test_bit(WDOG_UNREGISTERED, wddev-status)) { + if (test_bit(WDOG_UNREGISTERED, wdd-status)) { err = -ENODEV; goto out_start; } - if (watchdog_active(wddev)) + if (watchdog_active(wdd)) goto out_start; - err = wddev-ops-start(wddev); + err = wdd-ops-start(wdd); if (err == 0) - set_bit(WDOG_ACTIVE, wddev-status); + set_bit(WDOG_ACTIVE, wdd-status); out_start: - mutex_unlock(wddev-lock); + mutex_unlock(wdd-lock); return err; } /* * watchdog_stop: wrapper to stop the watchdog. - * @wddev: the watchdog device to stop + * @wdd: the watchdog device to stop * * Stop the watchdog if it is still active and unmark it active. * This function returns zero on success or a negative errno code for @@ -125,155 +125,154 @@ out_start: * If the 'nowayout' feature was set, the watchdog cannot be stopped. */ -static int watchdog_stop(struct watchdog_device *wddev) +static int watchdog_stop(struct watchdog_device *wdd) { int err = 0; - mutex_lock(wddev-lock); + mutex_lock(wdd-lock); - if (test_bit(WDOG_UNREGISTERED, wddev-status)) { + if (test_bit(WDOG_UNREGISTERED, wdd-status)) { err = -ENODEV; goto out_stop; } - if (!watchdog_active(wddev)) + if (!watchdog_active(wdd)) goto out_stop; - if (test_bit(WDOG_NO_WAY_OUT, wddev-status)) { - dev_info(wddev-dev, nowayout prevents watchdog being stopped!\n); + if (test_bit(WDOG_NO_WAY_OUT, wdd-status)) { + dev_info(wdd-dev, nowayout prevents watchdog being stopped!\n); err = -EBUSY; goto out_stop; } - err = wddev-ops-stop(wddev); + err = wdd-ops-stop(wdd); if (err == 0) - clear_bit(WDOG_ACTIVE, wddev-status); + clear_bit(WDOG_ACTIVE, wdd-status); out_stop: - mutex_unlock(wddev-lock); + mutex_unlock(wdd-lock); return err; } /* * watchdog_get_status: wrapper to get the watchdog status - * @wddev: the watchdog device to get the status from + * @wdd: the watchdog device to get the status from *