Skip to contentSkip to conversation

ipmi: kcs_bmc: don't change device name

PATCH In review Benjamin Fair 2 participants 3 messages Jul 6, 2018 – Jul 20, 2018 IPMI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipmi: kcs_bmc: don't change device name

kcs_bmc_alloc(...) calls dev_set_name(...) which is incorrect as most bus driver frameworks, platform_driver in particular, assume that they are able to set the device name themselves.

---
 drivers/char/ipmi/kcs_bmc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/char/ipmi/kcs_bmc.c +4 -3
index fbfc05e3f3d1..cd75118bb0ac 100644
@@ -16,6 +16,8 @@
 
 #include "kcs_bmc.h"
 
+#define DEVICE_NAME "ipmi-kcs"
+
 #define KCS_MSG_BUFSIZ    1000
 
 #define KCS_ZERO_DATA     0
@@ -440,8 +442,6 @@ struct kcs_bmc *kcs_bmc_alloc(struct device *dev, int sizeof_priv, u32 channel)
 	if (!kcs_bmc)
 		return NULL;
 
-	dev_set_name(dev, "ipmi-kcs%u", channel);
-
 	spin_lock_init(&kcs_bmc->lock);
 	kcs_bmc->channel = channel;
 
@@ -455,7 +455,8 @@ struct kcs_bmc *kcs_bmc_alloc(struct device *dev, int sizeof_priv, u32 channel)
 		return NULL;
 
 	kcs_bmc->miscdev.minor = MISC_DYNAMIC_MINOR;
-	kcs_bmc->miscdev.name = dev_name(dev);
+	kcs_bmc->miscdev.name = devm_kasprintf(dev, GFP_KERNEL, "%s%u",
+					       DEVICE_NAME, channel);
 	kcs_bmc->miscdev.fops = &kcs_bmc_fops;
 
 	return kcs_bmc;
Signature · 1 line
2.18.0.203.gfac676dfb9-goog
#1 lore raw
Quoted 3 lines · Benjamin Fair

kcs_bmc_alloc(...) calls dev_set_name(...) which is incorrect as most bus driver frameworks, platform_driver in particular, assume that they are able to set the device name themselves.

Sorry for the delay, I've been busy and on vacation.

This is queued for the next release.

-corey

Quoted 37 lines
---
  drivers/char/ipmi/kcs_bmc.c | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)
drivers/char/ipmi/kcs_bmc.c +4 -3
index fbfc05e3f3d1..cd75118bb0ac 100644
@@ -16,6 +16,8 @@
 
  #include "kcs_bmc.h"
 
+#define DEVICE_NAME "ipmi-kcs"
+
  #define KCS_MSG_BUFSIZ    1000
 
  #define KCS_ZERO_DATA     0
@@ -440,8 +442,6 @@ struct kcs_bmc *kcs_bmc_alloc(struct device *dev, int sizeof_priv, u32 channel)
  	if (!kcs_bmc)
  		return NULL;
 
-	dev_set_name(dev, "ipmi-kcs%u", channel);
-
  	spin_lock_init(&kcs_bmc->lock);
  	kcs_bmc->channel = channel;
 
@@ -455,7 +455,8 @@ struct kcs_bmc *kcs_bmc_alloc(struct device *dev, int sizeof_priv, u32 channel)
  		return NULL;
 
  	kcs_bmc->miscdev.minor = MISC_DYNAMIC_MINOR;
-	kcs_bmc->miscdev.name = dev_name(dev);
+	kcs_bmc->miscdev.name = devm_kasprintf(dev, GFP_KERNEL, "%s%u",
+					       DEVICE_NAME, channel);
  	kcs_bmc->miscdev.fops = &kcs_bmc_fops;
 
  	return kcs_bmc;
#2 lore raw
Quoted 11 lines · Corey Minyard
Quoted 3 lines · Benjamin Fair

kcs_bmc_alloc(...) calls dev_set_name(...) which is incorrect as most bus driver frameworks, platform_driver in particular, assume that they are able to set the device name themselves.

Sorry for the delay, I've been busy and on vacation.

This is queued for the next release.

-corey

Great! Thanks, Corey.