diff mbox series

watchdog: ziirave_wdt: Remove VERSION_FMT defines and add sysfs newlines

Message ID 20210520072918.76482-1-juergh@canonical.com
State New
Headers show
Series watchdog: ziirave_wdt: Remove VERSION_FMT defines and add sysfs newlines | expand

Commit Message

Juerg Haefliger May 20, 2021, 7:29 a.m. UTC
Remove the ZIIRAVE_{BL,FW}_VERION_FMT defines since they're only used in
very few places. While at it, add newlines to sysfs outputs.

Suggested-By: Joe Perches <joe@perches.com>
Signed-off-by: Juerg Haefliger <juergh@canonical.com>
---

 Depends on: https://lore.kernel.org/lkml/20210511061812.480172-1-juergh@canonical.com/

 drivers/watchdog/ziirave_wdt.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

Comments

Guenter Roeck May 20, 2021, 10:58 p.m. UTC | #1
On Thu, May 20, 2021 at 09:29:18AM +0200, Juerg Haefliger wrote:
> Remove the ZIIRAVE_{BL,FW}_VERION_FMT defines since they're only used in
> very few places. While at it, add newlines to sysfs outputs.
> 
> Suggested-By: Joe Perches <joe@perches.com>
> Signed-off-by: Juerg Haefliger <juergh@canonical.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
> 
>  Depends on: https://lore.kernel.org/lkml/20210511061812.480172-1-juergh@canonical.com/
> 
>  drivers/watchdog/ziirave_wdt.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/watchdog/ziirave_wdt.c b/drivers/watchdog/ziirave_wdt.c
> index 6c9414d09684..c5a9b820d43a 100644
> --- a/drivers/watchdog/ziirave_wdt.c
> +++ b/drivers/watchdog/ziirave_wdt.c
> @@ -69,9 +69,6 @@ static char *ziirave_reasons[] = {"power cycle", "hw watchdog", NULL, NULL,
>  #define ZIIRAVE_CMD_JUMP_TO_BOOTLOADER_MAGIC	1
>  #define ZIIRAVE_CMD_RESET_PROCESSOR_MAGIC	1
>  
> -#define ZIIRAVE_FW_VERSION_FMT	"02.%02u.%02u"
> -#define ZIIRAVE_BL_VERSION_FMT	"01.%02u.%02u"
> -
>  struct ziirave_wdt_rev {
>  	unsigned char major;
>  	unsigned char minor;
> @@ -445,7 +442,7 @@ static ssize_t ziirave_wdt_sysfs_show_firm(struct device *dev,
>  	if (ret)
>  		return ret;
>  
> -	ret = sysfs_emit(buf, ZIIRAVE_FW_VERSION_FMT,
> +	ret = sysfs_emit(buf, "02.%02u.%02u\n",
>  			 w_priv->firmware_rev.major,
>  			 w_priv->firmware_rev.minor);
>  
> @@ -469,7 +466,7 @@ static ssize_t ziirave_wdt_sysfs_show_boot(struct device *dev,
>  	if (ret)
>  		return ret;
>  
> -	ret = sysfs_emit(buf, ZIIRAVE_BL_VERSION_FMT,
> +	ret = sysfs_emit(buf, "01.%02u.%02u\n",
>  			 w_priv->bootloader_rev.major,
>  			 w_priv->bootloader_rev.minor);
>  
> @@ -493,7 +490,7 @@ static ssize_t ziirave_wdt_sysfs_show_reason(struct device *dev,
>  	if (ret)
>  		return ret;
>  
> -	ret = sysfs_emit(buf, "%s", ziirave_reasons[w_priv->reset_reason]);
> +	ret = sysfs_emit(buf, "%s\n", ziirave_reasons[w_priv->reset_reason]);
>  
>  	mutex_unlock(&w_priv->sysfs_mutex);
>  
> @@ -538,7 +535,7 @@ static ssize_t ziirave_wdt_sysfs_store_firm(struct device *dev,
>  	}
>  
>  	dev_info(&client->dev,
> -		 "Firmware updated to version " ZIIRAVE_FW_VERSION_FMT "\n",
> +		 "Firmware updated to version 02.%02u.%02u\n",
>  		 w_priv->firmware_rev.major, w_priv->firmware_rev.minor);
>  
>  	/* Restore the watchdog timeout */
> @@ -679,7 +676,7 @@ static int ziirave_wdt_probe(struct i2c_client *client,
>  	}
>  
>  	dev_info(&client->dev,
> -		 "Firmware version: " ZIIRAVE_FW_VERSION_FMT "\n",
> +		 "Firmware version: 02.%02u.%02u\n",
>  		 w_priv->firmware_rev.major, w_priv->firmware_rev.minor);
>  
>  	ret = ziirave_wdt_revision(client, &w_priv->bootloader_rev,
> @@ -690,7 +687,7 @@ static int ziirave_wdt_probe(struct i2c_client *client,
>  	}
>  
>  	dev_info(&client->dev,
> -		 "Bootloader version: " ZIIRAVE_BL_VERSION_FMT "\n",
> +		 "Bootloader version: 01.%02u.%02u\n",
>  		 w_priv->bootloader_rev.major, w_priv->bootloader_rev.minor);
>  
>  	w_priv->reset_reason = i2c_smbus_read_byte_data(client,
> -- 
> 2.27.0
>
diff mbox series

Patch

diff --git a/drivers/watchdog/ziirave_wdt.c b/drivers/watchdog/ziirave_wdt.c
index 6c9414d09684..c5a9b820d43a 100644
--- a/drivers/watchdog/ziirave_wdt.c
+++ b/drivers/watchdog/ziirave_wdt.c
@@ -69,9 +69,6 @@  static char *ziirave_reasons[] = {"power cycle", "hw watchdog", NULL, NULL,
 #define ZIIRAVE_CMD_JUMP_TO_BOOTLOADER_MAGIC	1
 #define ZIIRAVE_CMD_RESET_PROCESSOR_MAGIC	1
 
-#define ZIIRAVE_FW_VERSION_FMT	"02.%02u.%02u"
-#define ZIIRAVE_BL_VERSION_FMT	"01.%02u.%02u"
-
 struct ziirave_wdt_rev {
 	unsigned char major;
 	unsigned char minor;
@@ -445,7 +442,7 @@  static ssize_t ziirave_wdt_sysfs_show_firm(struct device *dev,
 	if (ret)
 		return ret;
 
-	ret = sysfs_emit(buf, ZIIRAVE_FW_VERSION_FMT,
+	ret = sysfs_emit(buf, "02.%02u.%02u\n",
 			 w_priv->firmware_rev.major,
 			 w_priv->firmware_rev.minor);
 
@@ -469,7 +466,7 @@  static ssize_t ziirave_wdt_sysfs_show_boot(struct device *dev,
 	if (ret)
 		return ret;
 
-	ret = sysfs_emit(buf, ZIIRAVE_BL_VERSION_FMT,
+	ret = sysfs_emit(buf, "01.%02u.%02u\n",
 			 w_priv->bootloader_rev.major,
 			 w_priv->bootloader_rev.minor);
 
@@ -493,7 +490,7 @@  static ssize_t ziirave_wdt_sysfs_show_reason(struct device *dev,
 	if (ret)
 		return ret;
 
-	ret = sysfs_emit(buf, "%s", ziirave_reasons[w_priv->reset_reason]);
+	ret = sysfs_emit(buf, "%s\n", ziirave_reasons[w_priv->reset_reason]);
 
 	mutex_unlock(&w_priv->sysfs_mutex);
 
@@ -538,7 +535,7 @@  static ssize_t ziirave_wdt_sysfs_store_firm(struct device *dev,
 	}
 
 	dev_info(&client->dev,
-		 "Firmware updated to version " ZIIRAVE_FW_VERSION_FMT "\n",
+		 "Firmware updated to version 02.%02u.%02u\n",
 		 w_priv->firmware_rev.major, w_priv->firmware_rev.minor);
 
 	/* Restore the watchdog timeout */
@@ -679,7 +676,7 @@  static int ziirave_wdt_probe(struct i2c_client *client,
 	}
 
 	dev_info(&client->dev,
-		 "Firmware version: " ZIIRAVE_FW_VERSION_FMT "\n",
+		 "Firmware version: 02.%02u.%02u\n",
 		 w_priv->firmware_rev.major, w_priv->firmware_rev.minor);
 
 	ret = ziirave_wdt_revision(client, &w_priv->bootloader_rev,
@@ -690,7 +687,7 @@  static int ziirave_wdt_probe(struct i2c_client *client,
 	}
 
 	dev_info(&client->dev,
-		 "Bootloader version: " ZIIRAVE_BL_VERSION_FMT "\n",
+		 "Bootloader version: 01.%02u.%02u\n",
 		 w_priv->bootloader_rev.major, w_priv->bootloader_rev.minor);
 
 	w_priv->reset_reason = i2c_smbus_read_byte_data(client,