public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: "devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"agraf@suse.de" <agraf@suse.de>, "arnd@arndb.de" <arnd@arndb.de>,
	"Ioana Ciornei" <ioana.ciornei@nxp.com>,
	Ruxandra Ioana Radulescu <ruxandra.radulescu@nxp.com>,
	Bharat Bhushan <bharat.bhushan@nxp.com>,
	"Stuart Yoder" <stuart.yoder@nxp.com>,
	Catalin Horghidan <catalin.horghidan@nxp.com>,
	Leo Li <leoyang.li@nxp.com>, Roy Pledge <roy.pledge@nxp.com>
Subject: Re: [PATCH 2/9] staging: fsl-mc: fix device ref counting
Date: Fri, 3 Feb 2017 10:17:53 +0000	[thread overview]
Message-ID: <589458CF.90804@nxp.com> (raw)
In-Reply-To: <20170203095645.GE24767@kroah.com>

Hi Greg,

Thanks for having a look. Comment below.

On 02/03/2017 11:56 AM, Greg KH wrote:
> On Wed, Feb 01, 2017 at 05:43:22AM -0600, laurentiu.tudor@nxp.com wrote:
>> From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
>>
>> Drop unneeded get_device() call at device creation
>> and, as per documentation, drop reference count
>> after using device_find_child() return.
>>
>> Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
>> ---
>>   drivers/staging/fsl-mc/bus/dprc-driver.c | 1 +
>>   drivers/staging/fsl-mc/bus/fsl-mc-bus.c  | 1 -
>>   2 files changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c
>> index 4e416d8..e4b0341 100644
>> --- a/drivers/staging/fsl-mc/bus/dprc-driver.c
>> +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c
>> @@ -188,6 +188,7 @@ static void dprc_add_new_devices(struct fsl_mc_device *mc_bus_dev,
>>   		child_dev = fsl_mc_device_lookup(obj_desc, mc_bus_dev);
>>   		if (child_dev) {
>>   			check_plugged_state_change(child_dev, obj_desc);
>> +			put_device(&child_dev->dev);
>>   			continue;
>>   		}
>>
>> diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
>> index cc20dc4..7c6a43b 100644
>> --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
>> +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
>> @@ -537,7 +537,6 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
>>   		goto error_cleanup_dev;
>>   	}
>>
>> -	(void)get_device(&mc_dev->dev);
>
> This implies that your device reference counting is totally wrong and
> messed up.  Does this fix anything?  Break anything?  It should do
> something different now...

It fixes the refcounting in the sense that I'm now seeing the error
that i think you were referring to in your previous reviews,
when we hot unplug a device:

"Device 'foo.N' does not have a release() function, it is broken and 
must be fixed."

See next patch that adds the required callback.

Regarding this particular get_device(), i have no clue why the
original author placed it here. I've looked over other bus 
implementations and didn't see something similar.

---
Best Regards, Laurentiu

  reply	other threads:[~2017-02-03 10:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-01 11:43 [PATCH 0/9] staging: fsl-mc: fixes and cleanups laurentiu.tudor
2017-02-01 11:43 ` [PATCH 1/9] staging: fsl-mc: drop root dprc counting laurentiu.tudor
2017-02-01 11:43 ` [PATCH 2/9] staging: fsl-mc: fix device ref counting laurentiu.tudor
2017-02-03  9:56   ` Greg KH
2017-02-03 10:17     ` Laurentiu Tudor [this message]
2017-02-03 10:31       ` Greg KH
2017-02-01 11:43 ` [PATCH 3/9] staging: fsl-mc: add device release callback laurentiu.tudor
2017-02-01 11:43 ` [PATCH 4/9] staging: fsl-mc: don't use devres api for refcounted objects laurentiu.tudor
2017-02-03  0:02   ` Stuart Yoder
2017-02-03 10:31     ` Laurentiu Tudor
2017-02-01 11:43 ` [PATCH 5/9] staging: fsl-mc: dpmcp: drop unused APIs laurentiu.tudor
2017-02-01 11:43 ` [PATCH 6/9] staging: fsl-mc: dpmng: drop unused prototype laurentiu.tudor
2017-02-01 11:43 ` [PATCH 7/9] staging: fsl-mc: dpbp: drop unused APIs laurentiu.tudor
2017-02-01 11:43 ` [PATCH 8/9] staging: fsl-mc: dpbp: add a few missing EXPORT_SYMBOL()s laurentiu.tudor
2017-02-01 11:43 ` [PATCH 9/9] staging: fsl-mc: dprc: drop unused APIs laurentiu.tudor
2017-02-03  0:03   ` Stuart Yoder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=589458CF.90804@nxp.com \
    --to=laurentiu.tudor@nxp.com \
    --cc=agraf@suse.de \
    --cc=arnd@arndb.de \
    --cc=bharat.bhushan@nxp.com \
    --cc=catalin.horghidan@nxp.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=ioana.ciornei@nxp.com \
    --cc=leoyang.li@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roy.pledge@nxp.com \
    --cc=ruxandra.radulescu@nxp.com \
    --cc=stuart.yoder@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox