eeprom: at24: Improve confusing log message
diff mbox series

Message ID 20191004103748.12076669@endymion
State Accepted
Headers show
Series
  • eeprom: at24: Improve confusing log message
Related show

Commit Message

Jean Delvare Oct. 4, 2019, 8:37 a.m. UTC
Currently when binding to an spd EEPROM, the at24 drivers logs the
following message:

256 byte spd EEPROM, read-only, 0 bytes/write

The last part is confusing, as by definition you don't write to a
read-only EEPROM, plus "0 bytes/write" makes no sense whatsoever.

I propose to have a different message for read-only EEPROMs, which
does not include this last part.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/misc/eeprom/at24.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Wolfram Sang Oct. 4, 2019, 8:43 a.m. UTC | #1
On Fri, Oct 04, 2019 at 10:37:48AM +0200, Jean Delvare wrote:
> Currently when binding to an spd EEPROM, the at24 drivers logs the
> following message:
> 
> 256 byte spd EEPROM, read-only, 0 bytes/write
> 
> The last part is confusing, as by definition you don't write to a
> read-only EEPROM, plus "0 bytes/write" makes no sense whatsoever.
> 
> I propose to have a different message for read-only EEPROMs, which
> does not include this last part.
> 
> Signed-off-by: Jean Delvare <jdelvare@suse.de>

I like it!

Reviewed-by: Wolfram Sang <wsa@the-dreams.de>
Bartosz Golaszewski Oct. 4, 2019, 8:48 a.m. UTC | #2
pt., 4 paź 2019 o 10:43 Wolfram Sang <wsa@the-dreams.de> napisał(a):
>
> On Fri, Oct 04, 2019 at 10:37:48AM +0200, Jean Delvare wrote:
> > Currently when binding to an spd EEPROM, the at24 drivers logs the
> > following message:
> >
> > 256 byte spd EEPROM, read-only, 0 bytes/write
> >
> > The last part is confusing, as by definition you don't write to a
> > read-only EEPROM, plus "0 bytes/write" makes no sense whatsoever.
> >
> > I propose to have a different message for read-only EEPROMs, which
> > does not include this last part.
> >
> > Signed-off-by: Jean Delvare <jdelvare@suse.de>
>
> I like it!
>
> Reviewed-by: Wolfram Sang <wsa@the-dreams.de>
>

Me too. Applied right away.

Bart

Patch
diff mbox series

--- linux-5.3.orig/drivers/misc/eeprom/at24.c	2019-09-15 23:19:32.000000000 +0200
+++ linux-5.3/drivers/misc/eeprom/at24.c	2019-10-04 10:32:19.110834275 +0200
@@ -717,9 +717,12 @@  static int at24_probe(struct i2c_client
 		return -ENODEV;
 	}
 
-	dev_info(dev, "%u byte %s EEPROM, %s, %u bytes/write\n",
-		 byte_len, client->name,
-		 writable ? "writable" : "read-only", at24->write_max);
+	if (writable)
+		dev_info(dev, "%u byte %s EEPROM, writable, %u bytes/write\n",
+			 byte_len, client->name, at24->write_max);
+	else
+		dev_info(dev, "%u byte %s EEPROM, read-only\n",
+			 byte_len, client->name);
 
 	return 0;
 }