All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: dinghao.liu@zju.edu.cn
Cc: kjlu@umn.edu,
	Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: Re: [PATCH] media: vsp1: Fix runtime PM imbalance in vsp1_probe
Date: Mon, 8 Jun 2020 06:11:34 +0300	[thread overview]
Message-ID: <20200608031134.GO22208@pendragon.ideasonboard.com> (raw)
In-Reply-To: <7b79863f.f636d.17291e1ff94.Coremail.dinghao.liu@zju.edu.cn>

Hi Dianghao,

On Mon, Jun 08, 2020 at 11:03:26AM +0800, dinghao.liu@zju.edu.cn wrote:
> Hi Laurent,
> 
> > > I wonder how many bugs we have today, and how many bugs will keep
> > > appearing in the future, due to this historical design mistake :-( 
> 
> Good question. It's hard to say if this is a design mistake (some use
> of this API does not check its return value and expects it always to
> increment the usage counter). But it does make developers misuse it easier.
> 
> > > This change looks good to me, but we also need a similar change in the
> > > vsp1_device_get() function if I'm not mistaken. Could you combine both
> > > in the same patch ?
> 
> Thank you for your advice! I think you are right and I will fix this in the
> next version of patch. 
> 
> > And actually, after fixing vsp1_device_get(), we should replace the
> > pm_runtime_get_sync() call here with vsp1_device_get(), and the
> > pm_runtime_put_sync() below with vsp1_device_put(), so there would be no
> > need to call pm_runtime_put_sync() manually in the error path here.
> 
> The parameter type of vsp1_device_get() and vsp1_device_put() is "struct 
> vsp1_device". If we want to use these two wrappers, we need to adjust their 
> parameter type to "struct platform_device" or "struct device", which may 
> lead to errors in other callers. Maybe we should leave it as it is.

The vsp1_probe() function has a struct vsp1_device whose dev field is
populated by the time it needs to call pm_runtime_get_sync() and
pm_runtime_get_put(), so I think you can use vsp1_device_get() and
vsp1_device_put() as drop-in replacements without changing the
parameters to these two functions.

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2020-06-08  3:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-23 11:54 [PATCH] media: vsp1: Fix runtime PM imbalance in vsp1_probe Dinghao Liu
2020-06-08  1:54 ` Laurent Pinchart
2020-06-08  1:57   ` Laurent Pinchart
2020-06-08  3:03     ` dinghao.liu
2020-06-08  3:11       ` Laurent Pinchart [this message]
2020-06-08  3:33         ` dinghao.liu
2020-06-08  7:39       ` Geert Uytterhoeven
2020-06-08 11:54         ` Laurent Pinchart

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=20200608031134.GO22208@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dinghao.liu@zju.edu.cn \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=kjlu@umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mchehab@kernel.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.