openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipmi: kcs_bmc: don't change device name
@ 2018-07-06 18:16 Benjamin Fair
  2018-07-20  0:52 ` Corey Minyard
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Fair @ 2018-07-06 18:16 UTC (permalink / raw)
  To: Corey Minyard, Arnd Bergmann, Greg Kroah-Hartman,
	openipmi-developer, joel, openbmc
  Cc: AviFishman70, tmaimon77, haiyue.wang, tali.perry1, 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.

Signed-off-by: Benjamin Fair <benjaminfair@google.com>
---
 drivers/char/ipmi/kcs_bmc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/char/ipmi/kcs_bmc.c b/drivers/char/ipmi/kcs_bmc.c
index fbfc05e3f3d1..cd75118bb0ac 100644
--- a/drivers/char/ipmi/kcs_bmc.c
+++ b/drivers/char/ipmi/kcs_bmc.c
@@ -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.18.0.203.gfac676dfb9-goog

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ipmi: kcs_bmc: don't change device name
  2018-07-06 18:16 [PATCH] ipmi: kcs_bmc: don't change device name Benjamin Fair
@ 2018-07-20  0:52 ` Corey Minyard
  2018-07-20  1:32   ` Benjamin Fair
  0 siblings, 1 reply; 3+ messages in thread
From: Corey Minyard @ 2018-07-20  0:52 UTC (permalink / raw)
  To: Benjamin Fair, Arnd Bergmann, Greg Kroah-Hartman,
	openipmi-developer, joel, openbmc
  Cc: AviFishman70, tmaimon77, haiyue.wang, tali.perry1

On 07/06/2018 01:16 PM, Benjamin Fair wrote:
> 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

> Signed-off-by: Benjamin Fair <benjaminfair@google.com>
> ---
>   drivers/char/ipmi/kcs_bmc.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/char/ipmi/kcs_bmc.c b/drivers/char/ipmi/kcs_bmc.c
> index fbfc05e3f3d1..cd75118bb0ac 100644
> --- a/drivers/char/ipmi/kcs_bmc.c
> +++ b/drivers/char/ipmi/kcs_bmc.c
> @@ -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;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ipmi: kcs_bmc: don't change device name
  2018-07-20  0:52 ` Corey Minyard
@ 2018-07-20  1:32   ` Benjamin Fair
  0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Fair @ 2018-07-20  1:32 UTC (permalink / raw)
  To: minyard
  Cc: Arnd Bergmann, gregkh, openipmi-developer, joel, openbmc,
	AviFishman70, tmaimon77, haiyue.wang, tali.perry1

On Thu, Jul 19, 2018 at 5:52 PM Corey Minyard <minyard@acm.org> wrote:
>
> On 07/06/2018 01:16 PM, Benjamin Fair wrote:
> > 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-07-20  1:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-06 18:16 [PATCH] ipmi: kcs_bmc: don't change device name Benjamin Fair
2018-07-20  0:52 ` Corey Minyard
2018-07-20  1:32   ` Benjamin Fair

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).