Skip to contentSkip to conversation

extcon: max8997: use dev_err() instead of pr_err()

PATCH Applied Jingoo Han 2 participants 5 messages Mar 19, 2013 External connector subsystem (extcon)

lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

PATCH v2 1/2 extcon: max8997: use dev_err() instead of pr_err()

dev_err() is more preferred than pr_err().

---
No Changes since v1:

 drivers/extcon/extcon-max8997.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/extcon/extcon-max8997.c +1 -1
index 69641bc..20772ad 100644
@@ -646,7 +646,7 @@ static void max8997_muic_detect_cable_wq(struct work_struct *work)
 
 	ret = max8997_muic_detect_dev(info);
 	if (ret < 0)
-		pr_err("failed to detect cable type\n");
+		dev_err(info->dev, "failed to detect cable type\n");
 }
 
 static int max8997_muic_probe(struct platform_device *pdev)
Signature · 1 line
1.7.2.5
author
#1 lore raw

PATCH v2 2/2 extcon: max8997: add missing const

Fixed the checkpatch warning as below:

WARNING: static const char * array should probably be static const char * const #163: FILE: drivers/extcon/extcon-max8997.c:163:
+static const char *max8997_extcon_cable[] = {

Also, const is added to variable 'supported_cable' to prevent build warning as below:

drivers/extcon/extcon-max8997.c: In function 'max8997_muic_probe':
drivers/extcon/extcon-max8997.c:708:30: warning: assignment discards 'const' qualifier from pointer target type [enabled by
default]

---
Changes since v1:
- Added const to variable 'supported_cable'

 drivers/extcon/extcon-max8997.c |    2 +-
 include/linux/extcon.h          |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/extcon/extcon-max8997.c +1 -1
index 20772ad..b82a591 100644
@@ -160,7 +160,7 @@ enum {
 	_EXTCON_CABLE_NUM,
 };
 
-static const char *max8997_extcon_cable[] = {
+static const char * const max8997_extcon_cable[] = {
 	[EXTCON_CABLE_USB]			= "USB",
 	[EXTCON_CABLE_USB_HOST]			= "USB-Host",
 	[EXTCON_CABLE_TA]			= "TA",
include/linux/extcon.h +1 -1
index fcb51c8..741a491 100644
@@ -113,7 +113,7 @@ struct extcon_cable;
 struct extcon_dev {
 	/* --- Optional user initializing data --- */
 	const char	*name;
-	const char **supported_cable;
+	const char * const *supported_cable;
 	const u32	*mutually_exclusive;
 
 	/* --- Optional callbacks to override class functions --- */
Signature · 1 line
1.7.2.5
maintainer
#2 lore raw

Re: [PATCH v2 2/2] extcon: max8997: add missing const

Quoted 27 lines · Jingoo Han

Fixed the checkpatch warning as below:

WARNING: static const char * array should probably be static const char * const #163: FILE: drivers/extcon/extcon-max8997.c:163:
+static const char *max8997_extcon_cable[] = {

Also, const is added to variable 'supported_cable' to prevent build warning as below:

drivers/extcon/extcon-max8997.c: In function 'max8997_muic_probe':
drivers/extcon/extcon-max8997.c:708:30: warning: assignment discards 'const' qualifier from pointer target type [enabled by
default]

---
Changes since v1:
- Added const to variable 'supported_cable'

 drivers/extcon/extcon-max8997.c |    2 +-
 include/linux/extcon.h          |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/extcon/extcon-max8997.c +0 -0
index 20772ad..b82a591 100644

drivers/extcon/extcon-max8997.c enum { · line 163

Quoted 5 lines
drivers/extcon/extcon-max8997.c +1 -1
@@ -160,7 +160,7 @@ enum {
 	_EXTCON_CABLE_NUM,
 };
 
-static const char *max8997_extcon_cable[] = {
+static const char * const max8997_extcon_cable[] = {

OK.

include/linux/extcon.h struct extcon_cable; · line 116

Quoted 13 lines
drivers/extcon/extcon-max8997.c +0 -0
 	[EXTCON_CABLE_USB]			= "USB",
 	[EXTCON_CABLE_USB_HOST]			= "USB-Host",
 	[EXTCON_CABLE_TA]			= "TA",
include/linux/extcon.h +1 -1
index fcb51c8..741a491 100644
@@ -113,7 +113,7 @@ struct extcon_cable;
 struct extcon_dev {
 	/* --- Optional user initializing data --- */
 	const char	*name;
-	const char **supported_cable;
+	const char * const *supported_cable;

I understand your intention to fix build warning. But, I don't agree this coding style. I think this coding style is not general method.

Thanks,
Chanwoo Choi

author
#3 lore raw

RE: [PATCH v2 2/2] extcon: max8997: add missing const

Quoted 36 lines · Chanwoo Choi
Quoted 11 lines · Jingoo Han

Fixed the checkpatch warning as below:

WARNING: static const char * array should probably be static const char * const #163: FILE: drivers/extcon/extcon-max8997.c:163:
+static const char *max8997_extcon_cable[] = {

Also, const is added to variable 'supported_cable' to prevent build warning as below:

drivers/extcon/extcon-max8997.c: In function 'max8997_muic_probe':
drivers/extcon/extcon-max8997.c:708:30: warning: assignment discards 'const' qualifier from pointer

target type [enabled by

Quoted 16 lines

default]

---
Changes since v1:
- Added const to variable 'supported_cable'

 drivers/extcon/extcon-max8997.c |    2 +-
 include/linux/extcon.h          |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/extcon/extcon-max8997.c +0 -0
index 20772ad..b82a591 100644

drivers/extcon/extcon-max8997.c enum { · line 163

Quoted 5 lines
drivers/extcon/extcon-max8997.c +1 -1
@@ -160,7 +160,7 @@ enum {
 	_EXTCON_CABLE_NUM,
 };
 
-static const char *max8997_extcon_cable[] = {
+static const char * const max8997_extcon_cable[] = {

OK.

Quoted 16 lines

include/linux/extcon.h struct extcon_cable; · line 116

Quoted 13 lines
drivers/extcon/extcon-max8997.c +0 -0
 	[EXTCON_CABLE_USB]			= "USB",
 	[EXTCON_CABLE_USB_HOST]			= "USB-Host",
 	[EXTCON_CABLE_TA]			= "TA",
include/linux/extcon.h +1 -1
index fcb51c8..741a491 100644
@@ -113,7 +113,7 @@ struct extcon_cable;
 struct extcon_dev {
 	/* --- Optional user initializing data --- */
 	const char	*name;
-	const char **supported_cable;
+	const char * const *supported_cable;

I understand your intention to fix build warning. But, I don't agree this coding style. I think this coding style is not general method.

Um, how about the following?
In this case, there is no build warning and checkpatch warning.

-static const char *max8997_extcon_cable[] = {
+static char const *max8997_extcon_cable[] = {

Quoted 5 lines

Thanks,
Chanwoo Choi

maintainer Applied
#4 lore raw
In reply to Jingoo Han
Quoted 14 lines · Jingoo Han

dev_err() is more preferred than pr_err().

---
No Changes since v1:

 drivers/extcon/extcon-max8997.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/extcon/extcon-max8997.c +0 -0
index 69641bc..20772ad 100644

drivers/extcon/extcon-max8997.c static void max8997_muic_detect_cable_wq(struct work_struct *work) · line 652

Quoted 8 lines
drivers/extcon/extcon-max8997.c +1 -1
@@ -646,7 +646,7 @@ static void max8997_muic_detect_cable_wq(struct work_struct *work)
 
 	ret = max8997_muic_detect_dev(info);
 	if (ret < 0)
-		pr_err("failed to detect cable type\n");
+		dev_err(info->dev, "failed to detect cable type\n");
 }
 
 static int max8997_muic_probe(struct platform_device *pdev)

Applied it. Thanks.

Chanwoo Choi