All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ohad Ben-Cohen <ohad@wizery.com>
To: Stephen Boyd <sboyd@codeaurora.org>
Cc: linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Fernando Guzman Lugo <fernando.lugo@ti.com>
Subject: Re: [PATCH 2/2] remoteproc: remove the now-redundant kref
Date: Wed, 30 May 2012 15:38:01 +0300	[thread overview]
Message-ID: <CAK=WgbbwaMAnTGcivC9ZR8K-MtTqHAV3+BgUmk8WjCaayifJxw@mail.gmail.com> (raw)
In-Reply-To: <4FC5DD74.4030202@codeaurora.org>

On Wed, May 30, 2012 at 11:42 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> I was hoping we could use class_for_each_device() and
> class_find_device() to replace all this code. Then we wouldn't need all
> this klist stuff that the class is taking care of already.

Awesome! This really is worth a shot.

>> +/**
>> + * rproc_class_release() - release a remote processor instance
>> + * @dev: the rproc's device
>> + *
>> + * This function should _never_ be called directly.
>> + *
>> + * It will be called by the driver core when no one holds a valid pointer
>> + * to @dev anymore.
>> + */
>
> Why is this added now and not in the previous patch?

Hmm, probably because it was copied from rproc_release, which was
killed in this patch. I can probably shift it to the first patch since
I'm anyway doing some changes.

>> -     /* the rproc will only be released after its refcount drops to zero */
>> -     kref_put(&rproc->refcount, rproc_release);
>> +     /* unroll rproc_alloc. TODO: we may want to let the users do that */
>> +     put_device(&rproc->dev);
>
> Yes I think we want rproc_free() to actually call put_device() the last
> time and free the resources.

Yeah that was one of the options I considered.

In general, we have three options here:
1. Remove this last put_device invocation, and require users to call
rproc_free() even after they call rproc_unregister().
2. Let rproc_unregister() still do this, by calling rproc_free().
3. Let rproc_unregister() still do this, by invoking put_device().

I think that (1) looks better since it makes the interface symmetric
and straight forward.

(2) and (3) may be simper because users only need to call
rproc_unregister and that's it.

I eventually decided against (1) because I was concerned it will only
confuse users at this point.

But if you think that (1) is nicer too then maybe we should go ahead
and do that change.

Thanks,
Ohad.

WARNING: multiple messages have this Message-ID (diff)
From: ohad@wizery.com (Ohad Ben-Cohen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] remoteproc: remove the now-redundant kref
Date: Wed, 30 May 2012 15:38:01 +0300	[thread overview]
Message-ID: <CAK=WgbbwaMAnTGcivC9ZR8K-MtTqHAV3+BgUmk8WjCaayifJxw@mail.gmail.com> (raw)
In-Reply-To: <4FC5DD74.4030202@codeaurora.org>

On Wed, May 30, 2012 at 11:42 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> I was hoping we could use class_for_each_device() and
> class_find_device() to replace all this code. Then we wouldn't need all
> this klist stuff that the class is taking care of already.

Awesome! This really is worth a shot.

>> +/**
>> + * rproc_class_release() - release a remote processor instance
>> + * @dev: the rproc's device
>> + *
>> + * This function should _never_ be called directly.
>> + *
>> + * It will be called by the driver core when no one holds a valid pointer
>> + * to @dev anymore.
>> + */
>
> Why is this added now and not in the previous patch?

Hmm, probably because it was copied from rproc_release, which was
killed in this patch. I can probably shift it to the first patch since
I'm anyway doing some changes.

>> - ? ? /* the rproc will only be released after its refcount drops to zero */
>> - ? ? kref_put(&rproc->refcount, rproc_release);
>> + ? ? /* unroll rproc_alloc. TODO: we may want to let the users do that */
>> + ? ? put_device(&rproc->dev);
>
> Yes I think we want rproc_free() to actually call put_device() the last
> time and free the resources.

Yeah that was one of the options I considered.

In general, we have three options here:
1. Remove this last put_device invocation, and require users to call
rproc_free() even after they call rproc_unregister().
2. Let rproc_unregister() still do this, by calling rproc_free().
3. Let rproc_unregister() still do this, by invoking put_device().

I think that (1) looks better since it makes the interface symmetric
and straight forward.

(2) and (3) may be simper because users only need to call
rproc_unregister and that's it.

I eventually decided against (1) because I was concerned it will only
confuse users at this point.

But if you think that (1) is nicer too then maybe we should go ahead
and do that change.

Thanks,
Ohad.

  reply	other threads:[~2012-05-30 12:38 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-26  7:36 [PATCH 1/2] remoteproc: maintain a generic child device for each rproc Ohad Ben-Cohen
2012-05-26  7:36 ` Ohad Ben-Cohen
2012-05-26  7:36 ` Ohad Ben-Cohen
2012-05-26  7:36 ` [PATCH 2/2] remoteproc: remove the now-redundant kref Ohad Ben-Cohen
2012-05-26  7:36   ` Ohad Ben-Cohen
2012-05-26  7:36   ` Ohad Ben-Cohen
2012-05-30  8:42   ` Stephen Boyd
2012-05-30  8:42     ` Stephen Boyd
2012-05-30 12:38     ` Ohad Ben-Cohen [this message]
2012-05-30 12:38       ` Ohad Ben-Cohen
2012-06-04 21:22       ` Stephen Boyd
2012-06-04 21:22         ` Stephen Boyd
2012-06-05 10:25         ` Ohad Ben-Cohen
2012-06-05 10:25           ` Ohad Ben-Cohen
2012-07-02  8:52         ` Ohad Ben-Cohen
2012-07-02  8:52           ` Ohad Ben-Cohen
2012-07-02  8:59           ` Russell King - ARM Linux
2012-07-02  8:59             ` Russell King - ARM Linux
2012-07-02  9:05             ` Ohad Ben-Cohen
2012-07-02  9:05               ` Ohad Ben-Cohen
2012-07-15 10:10           ` Ohad Ben-Cohen
2012-07-15 10:10             ` Ohad Ben-Cohen
2012-07-15  9:17   ` Ohad Ben-Cohen
2012-07-15  9:17     ` Ohad Ben-Cohen
2012-05-30  8:36 ` [PATCH 1/2] remoteproc: maintain a generic child device for each rproc Stephen Boyd
2012-05-30  8:36   ` Stephen Boyd
2012-05-30 12:16   ` Ohad Ben-Cohen
2012-05-30 12:16     ` Ohad Ben-Cohen
2012-05-30 12:16     ` Ohad Ben-Cohen
2012-06-04 21:22     ` Stephen Boyd
2012-06-04 21:22       ` Stephen Boyd
2012-06-29  8:13     ` Ohad Ben-Cohen
2012-06-29  8:13       ` Ohad Ben-Cohen
2012-07-02 19:06       ` Stephen Boyd
2012-07-02 19:06         ` Stephen Boyd
2012-07-02 19:54         ` Ohad Ben-Cohen
2012-07-02 19:54           ` Ohad Ben-Cohen
2012-07-05 20:35           ` Stephen Boyd
2012-07-05 20:35             ` Stephen Boyd
2012-07-15  9:12             ` Ohad Ben-Cohen
2012-07-15  9:12               ` Ohad Ben-Cohen

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='CAK=WgbbwaMAnTGcivC9ZR8K-MtTqHAV3+BgUmk8WjCaayifJxw@mail.gmail.com' \
    --to=ohad@wizery.com \
    --cc=fernando.lugo@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=sboyd@codeaurora.org \
    /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 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.