Skip to contentSkip to conversation

radio-si470x: remove h from printk format specifier

PATCH In review [email protected] 2 participants 3 messages Dec 15, 2020 – Dec 16, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 radio-si470x: remove h from printk format specifier

From: Tom Rix <[email protected]>

See Documentation/core-api/printk-formats.rst.

commit cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of unnecessary %h[xudi] and %hh[xudi]")

Standard integer promotion is already done and %hx and %hhx is useless so do not encourage the use of %hh[xudi] or %h[xudi].

---
 drivers/media/radio/si470x/radio-si470x-i2c.c | 2 +-
 drivers/media/radio/si470x/radio-si470x-usb.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/media/radio/si470x/radio-si470x-i2c.c +1 -1
index f491420d7b53..6a25c29d5d4d 100644
@@ -410,7 +410,7 @@ static int si470x_i2c_probe(struct i2c_client *client)
 			radio->registers[DEVICEID], radio->registers[SI_CHIPID]);
 	if ((radio->registers[SI_CHIPID] & SI_CHIPID_FIRMWARE) < RADIO_FW_VERSION) {
 		dev_warn(&client->dev,
-			"This driver is known to work with firmware version %hu,\n",
+			"This driver is known to work with firmware version %u,\n",
 			RADIO_FW_VERSION);
 		dev_warn(&client->dev,
 			"but the device has firmware version %hu.\n",
drivers/media/radio/si470x/radio-si470x-usb.c +2 -2
index fedff68d8c49..ce0709aae4a0 100644
@@ -681,7 +681,7 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,
 			radio->registers[DEVICEID], radio->registers[SI_CHIPID]);
 	if ((radio->registers[SI_CHIPID] & SI_CHIPID_FIRMWARE) < RADIO_FW_VERSION) {
 		dev_warn(&intf->dev,
-			"This driver is known to work with firmware version %hu,\n",
+			"This driver is known to work with firmware version %u,\n",
 			RADIO_FW_VERSION);
 		dev_warn(&intf->dev,
 			"but the device has firmware version %hu.\n",
@@ -698,7 +698,7 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,
 			radio->software_version, radio->hardware_version);
 	if (radio->hardware_version < RADIO_HW_VERSION) {
 		dev_warn(&intf->dev,
-			"This driver is known to work with hardware version %hu,\n",
+			"This driver is known to work with hardware version %u,\n",
 			RADIO_HW_VERSION);
 		dev_warn(&intf->dev,
 			"but the device has hardware version %hu.\n",
Signature · 1 line
2.27.0
#1 lore raw
Quoted 8 lines · On Tue, 2020-12-15 at 13:33 -0800, [email protected] wrote:

From: Tom Rix <[email protected]>

See Documentation/core-api/printk-formats.rst.

commit cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of unnecessary %h[xudi] and %hh[xudi]")

Standard integer promotion is already done and %hx and %hhx is useless so do not encourage the use of %hh[xudi] or %h[xudi].

[]

drivers/media/radio/si470x/radio-si470x-i2c.c

Quoted 1 line
drivers/media/radio/si470x/radio-si470x-i2c.c +0 -0

[]

drivers/media/radio/si470x/radio-si470x-i2c.c static int si470x_i2c_probe(struct i2c_client *client) · line 416

Quoted 9 lines
drivers/media/radio/si470x/radio-si470x-i2c.c +1 -1
@@ -410,7 +410,7 @@ static int si470x_i2c_probe(struct i2c_client *client)
  			radio->registers[DEVICEID], radio->registers[SI_CHIPID]);
  	if ((radio->registers[SI_CHIPID] & SI_CHIPID_FIRMWARE) < RADIO_FW_VERSION) {
  		dev_warn(&client->dev,
-			"This driver is known to work with firmware version %hu,\n",
+			"This driver is known to work with firmware version %u,\n",
  			RADIO_FW_VERSION);
  		dev_warn(&client->dev,
  			"but the device has firmware version %hu.\n",

Tom? Do you know why your script missed this %hu?

btw: this would probably better as a single line something like:

		dev_warn(&client->dev,
			 "Firmware version: %u is older than known working version %u\n",
			 radio->registers[SI_CHIPID] & SI_CHIPID_FIRMWARE
			 RADIO_FW_VERSION);

Also a few lines above is:

	dev_info(&client->dev, "DeviceID=0x%4.4hx ChipID=0x%4.4hx\n",
			radio->registers[DEVICEID], radio->registers[SI_CHIPID])

and these %4.4hx uses are also not changed by this patch.

author
#2 lore raw
Quoted 12 lines · Joe Perches
Quoted 8 lines · On Tue, 2020-12-15 at 13:33 -0800, [email protected] wrote:

From: Tom Rix <[email protected]>

See Documentation/core-api/printk-formats.rst.

commit cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of unnecessary %h[xudi] and %hh[xudi]")

Standard integer promotion is already done and %hx and %hhx is useless so do not encourage the use of %hh[xudi] or %h[xudi].

[]

drivers/media/radio/si470x/radio-si470x-i2c.c

Quoted 1 line
drivers/media/radio/si470x/radio-si470x-i2c.c +0 -0

[]

Quoted 10 lines

drivers/media/radio/si470x/radio-si470x-i2c.c static int si470x_i2c_probe(struct i2c_client *client) · line 416

Quoted 9 lines
drivers/media/radio/si470x/radio-si470x-i2c.c +1 -1
@@ -410,7 +410,7 @@ static int si470x_i2c_probe(struct i2c_client *client)
  			radio->registers[DEVICEID], radio->registers[SI_CHIPID]);
  	if ((radio->registers[SI_CHIPID] & SI_CHIPID_FIRMWARE) < RADIO_FW_VERSION) {
  		dev_warn(&client->dev,
-			"This driver is known to work with firmware version %hu,\n",
+			"This driver is known to work with firmware version %u,\n",
  			RADIO_FW_VERSION);
  		dev_warn(&client->dev,
  			"but the device has firmware version %hu.\n",

Tom? Do you know why your script missed this %hu?

Boooo..

I am making an assumption that there is only string.

Let me fix that and resend.

Thanks for catching the problem,

Tom

Quoted 16 lines

btw: this would probably better as a single line something like:

		dev_warn(&client->dev,
			 "Firmware version: %u is older than known working version %u\n",
			 radio->registers[SI_CHIPID] & SI_CHIPID_FIRMWARE
			 RADIO_FW_VERSION);

Also a few lines above is:

	dev_info(&client->dev, "DeviceID=0x%4.4hx ChipID=0x%4.4hx\n",
			radio->registers[DEVICEID], radio->registers[SI_CHIPID])

and these %4.4hx uses are also not changed by this patch.