All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Revert "mfd: cros_ec: Remove unused __remove function"
@ 2018-06-20 21:30 Dmitry Torokhov
  2018-06-20 21:30 ` [PATCH 2/2] Revert "mfd: cros_ec: Use devm_kzalloc for private data" Dmitry Torokhov
  2018-07-04  6:48 ` [PATCH 1/2] Revert "mfd: cros_ec: Remove unused __remove function" Lee Jones
  0 siblings, 2 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2018-06-20 21:30 UTC (permalink / raw)
  To: Lee Jones; +Cc: Arnd Bergmann, linux-kernel, Gwendal Grignou, Benson Leung

This reverts commit 556c242045f0c1613aac2e64dc5b2ff0e4bc89e1.

The patch that this change is purported to fix is broken and should be
reverted; thus we reverting this one as well.
---

Lee,

I see the broken code is already in Linus' tree, so please merge send
it on at your earliest convenience.

Thanks,
Dmitry


 drivers/mfd/cros_ec_dev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
index 306e1fd109bd..4b1dbe81fcb6 100644
--- a/drivers/mfd/cros_ec_dev.c
+++ b/drivers/mfd/cros_ec_dev.c
@@ -262,6 +262,8 @@ static const struct file_operations fops = {
 #endif
 };
 
+static void __remove(struct device *dev) { }
+
 static void cros_ec_sensors_register(struct cros_ec_dev *ec)
 {
 	/*
-- 
2.18.0.rc1.244.gcf134e6275-goog


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

* [PATCH 2/2] Revert "mfd: cros_ec: Use devm_kzalloc for private data"
  2018-06-20 21:30 [PATCH 1/2] Revert "mfd: cros_ec: Remove unused __remove function" Dmitry Torokhov
@ 2018-06-20 21:30 ` Dmitry Torokhov
  2018-07-04  7:00   ` Lee Jones
  2018-07-04  6:48 ` [PATCH 1/2] Revert "mfd: cros_ec: Remove unused __remove function" Lee Jones
  1 sibling, 1 reply; 6+ messages in thread
From: Dmitry Torokhov @ 2018-06-20 21:30 UTC (permalink / raw)
  To: Lee Jones; +Cc: Arnd Bergmann, linux-kernel, Gwendal Grignou, Benson Leung

This reverts commit 3aa2177e47878f7e7616da8a2050c44f22301b6e.

Linux device objects are refcounted and thus should not be allocated
with devm API as they may outlive the timeframe of another device being
bound to a driver.
---
 drivers/mfd/cros_ec_dev.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
index 4b1dbe81fcb6..bd4d4e7ec040 100644
--- a/drivers/mfd/cros_ec_dev.c
+++ b/drivers/mfd/cros_ec_dev.c
@@ -262,7 +262,12 @@ static const struct file_operations fops = {
 #endif
 };
 
-static void __remove(struct device *dev) { }
+static void __remove(struct device *dev)
+{
+	struct cros_ec_dev *ec = container_of(dev, struct cros_ec_dev,
+					      class_dev);
+	kfree(ec);
+}
 
 static void cros_ec_sensors_register(struct cros_ec_dev *ec)
 {
@@ -388,7 +393,7 @@ static int ec_device_probe(struct platform_device *pdev)
 	int retval = -ENOMEM;
 	struct device *dev = &pdev->dev;
 	struct cros_ec_platform *ec_platform = dev_get_platdata(dev);
-	struct cros_ec_dev *ec = devm_kzalloc(dev, sizeof(*ec), GFP_KERNEL);
+	struct cros_ec_dev *ec = kzalloc(sizeof(*ec), GFP_KERNEL);
 
 	if (!ec)
 		return retval;
@@ -410,6 +415,7 @@ static int ec_device_probe(struct platform_device *pdev)
 	ec->class_dev.devt = MKDEV(ec_major, pdev->id);
 	ec->class_dev.class = &cros_class;
 	ec->class_dev.parent = dev;
+	ec->class_dev.release = __remove;
 
 	retval = dev_set_name(&ec->class_dev, "%s", ec_platform->ec_name);
 	if (retval) {
-- 
2.18.0.rc1.244.gcf134e6275-goog


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

* Re: [PATCH 1/2] Revert "mfd: cros_ec: Remove unused __remove function"
  2018-06-20 21:30 [PATCH 1/2] Revert "mfd: cros_ec: Remove unused __remove function" Dmitry Torokhov
  2018-06-20 21:30 ` [PATCH 2/2] Revert "mfd: cros_ec: Use devm_kzalloc for private data" Dmitry Torokhov
@ 2018-07-04  6:48 ` Lee Jones
  2018-07-04 15:16   ` Dmitry Torokhov
  1 sibling, 1 reply; 6+ messages in thread
From: Lee Jones @ 2018-07-04  6:48 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Arnd Bergmann, linux-kernel, Gwendal Grignou, Benson Leung

On Wed, 20 Jun 2018, Dmitry Torokhov wrote:

> This reverts commit 556c242045f0c1613aac2e64dc5b2ff0e4bc89e1.
> 
> The patch that this change is purported to fix is broken and should be
> reverted; thus we reverting this one as well.

You need to provide more information.

How does the original patch break the build/code execution?
What is this patch doing to rectify the issue?
Any other information you think is relevant.

> ---
> 
> Lee,
> 
> I see the broken code is already in Linus' tree, so please merge send
> it on at your earliest convenience.
> 
> Thanks,
> Dmitry
> 
> 
>  drivers/mfd/cros_ec_dev.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
> index 306e1fd109bd..4b1dbe81fcb6 100644
> --- a/drivers/mfd/cros_ec_dev.c
> +++ b/drivers/mfd/cros_ec_dev.c
> @@ -262,6 +262,8 @@ static const struct file_operations fops = {
>  #endif
>  };
>  
> +static void __remove(struct device *dev) { }
> +
>  static void cros_ec_sensors_register(struct cros_ec_dev *ec)
>  {
>  	/*

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 2/2] Revert "mfd: cros_ec: Use devm_kzalloc for private data"
  2018-06-20 21:30 ` [PATCH 2/2] Revert "mfd: cros_ec: Use devm_kzalloc for private data" Dmitry Torokhov
@ 2018-07-04  7:00   ` Lee Jones
  0 siblings, 0 replies; 6+ messages in thread
From: Lee Jones @ 2018-07-04  7:00 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Arnd Bergmann, linux-kernel, Gwendal Grignou, Benson Leung

On Wed, 20 Jun 2018, Dmitry Torokhov wrote:

> This reverts commit 3aa2177e47878f7e7616da8a2050c44f22301b6e.
> 
> Linux device objects are refcounted and thus should not be allocated
> with devm API as they may outlive the timeframe of another device being
> bound to a driver.
> ---
>  drivers/mfd/cros_ec_dev.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)

For my own reference:
  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 1/2] Revert "mfd: cros_ec: Remove unused __remove function"
  2018-07-04  6:48 ` [PATCH 1/2] Revert "mfd: cros_ec: Remove unused __remove function" Lee Jones
@ 2018-07-04 15:16   ` Dmitry Torokhov
  2018-07-04 16:11     ` Lee Jones
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Torokhov @ 2018-07-04 15:16 UTC (permalink / raw)
  To: Lee Jones; +Cc: Arnd Bergmann, linux-kernel, Gwendal Grignou, Benson Leung

Hi Lee,

On Wed, Jul 04, 2018 at 07:48:11AM +0100, Lee Jones wrote:
> On Wed, 20 Jun 2018, Dmitry Torokhov wrote:
> 
> > This reverts commit 556c242045f0c1613aac2e64dc5b2ff0e4bc89e1.
> > 
> > The patch that this change is purported to fix is broken and should be
> > reverted; thus we reverting this one as well.
> 
> You need to provide more information.
> 
> How does the original patch break the build/code execution?
> What is this patch doing to rectify the issue?
> Any other information you think is relevant.

We are reverting this patch because it is not needed: it tries to fix
another patch that is completely broken and needs to be reverted. The
justification for reverting the original broken patch is in the revert
of that patch, but just for reference:

We should not use devm_kzalloc() to allocate refcounted objects.

Thanks.

-- 
Dmitry

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

* Re: [PATCH 1/2] Revert "mfd: cros_ec: Remove unused __remove function"
  2018-07-04 15:16   ` Dmitry Torokhov
@ 2018-07-04 16:11     ` Lee Jones
  0 siblings, 0 replies; 6+ messages in thread
From: Lee Jones @ 2018-07-04 16:11 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Arnd Bergmann, linux-kernel, Gwendal Grignou, Benson Leung

On Wed, 04 Jul 2018, Dmitry Torokhov wrote:
> On Wed, Jul 04, 2018 at 07:48:11AM +0100, Lee Jones wrote:
> > On Wed, 20 Jun 2018, Dmitry Torokhov wrote:
> > 
> > > This reverts commit 556c242045f0c1613aac2e64dc5b2ff0e4bc89e1.
> > > 
> > > The patch that this change is purported to fix is broken and should be
> > > reverted; thus we reverting this one as well.
> > 
> > You need to provide more information.
> > 
> > How does the original patch break the build/code execution?
> > What is this patch doing to rectify the issue?
> > Any other information you think is relevant.
> 
> We are reverting this patch because it is not needed: it tries to fix
> another patch that is completely broken and needs to be reverted. The
> justification for reverting the original broken patch is in the revert
> of that patch, but just for reference:
> 
> We should not use devm_kzalloc() to allocate refcounted objects.

The other patch looked good.  Please ensure the story is told in each
of the patches individually though.  That way they can be are viewed
by an outsider the history can be read and understood independently.

Thanks in advance.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

end of thread, other threads:[~2018-07-04 16:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-20 21:30 [PATCH 1/2] Revert "mfd: cros_ec: Remove unused __remove function" Dmitry Torokhov
2018-06-20 21:30 ` [PATCH 2/2] Revert "mfd: cros_ec: Use devm_kzalloc for private data" Dmitry Torokhov
2018-07-04  7:00   ` Lee Jones
2018-07-04  6:48 ` [PATCH 1/2] Revert "mfd: cros_ec: Remove unused __remove function" Lee Jones
2018-07-04 15:16   ` Dmitry Torokhov
2018-07-04 16:11     ` Lee Jones

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.