From: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
To: Javier Martinez Canillas <javier@dowhile0.org>
Cc: "Linux Media Mailing List" <linux-media@vger.kernel.org>,
"Mauro Carvalho Chehab" <mchehab@infradead.org>,
"Shuah Khan" <shuahkh@osg.samsung.com>,
"Kyungmin Park" <kyungmin.park@samsung.com>,
"Sylwester Nawrocki" <s.nawrocki@samsung.com>,
"Kukjin Kim" <kgene@kernel.org>,
"Krzysztof Kozlowski" <k.kozlowski@samsung.com>,
"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
"Hyun Kwon" <hyun.kwon@xilinx.com>,
"Michal Simek" <michal.simek@xilinx.com>,
"Sören Brinkmann" <soren.brinkmann@xilinx.com>,
"Antti Palosaari" <crope@iki.fi>,
"Javier Martinez Canillas" <javier@osg.samsung.com>,
"Sakari Ailus" <sakari.ailus@linux.intel.com>,
"Stefan Richter" <stefanr@s5r6.in-berlin.de>,
"Hans Verkuil" <hans.verkuil@cisco.com>,
"Seung-Woo Kim" <sw0312.kim@samsung.com>,
"Junghak Sung" <jh1009.sung@samsung.com>,
"Geunyoung Kim" <nenggun.kim@samsung.com>,
"Arnd Bergmann" <arnd@arndb.de>,
"Rafael Lourenço de Lima Chehab" <chehabrafael@gmail.com>,
"Matthias Schwarzott" <zzam@gentoo.org>,
"Tommi Rantala" <tt.rantala@gmail.com>,
"Patrick Boettcher" <patrick.boettcher@posteo.de>,
"Luis de Bethencourt" <luis@debethencourt.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-samsung-soc@vger.kernel.org"
<linux-samsung-soc@vger.kernel.org>,
linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH 5/5] [media] media-device: make media_device_cleanup() static
Date: Wed, 16 Mar 2016 11:36:25 -0300 [thread overview]
Message-ID: <20160316113625.23f1bf82@recife.lan> (raw)
In-Reply-To: <CABxcv=mvtXBs9qu6+HDbiB4pmMAM9cf=3mPTtLp0XWftRrGM1g@mail.gmail.com>
Em Wed, 16 Mar 2016 11:03:38 -0300
Javier Martinez Canillas <javier@dowhile0.org> escreveu:
> Hello Mauro,
>
> The patch looks mostly good to me, I just have a question below:
>
> On Wed, Mar 16, 2016 at 9:04 AM, Mauro Carvalho Chehab
> <mchehab@osg.samsung.com> wrote:
>
> [snip]
>
> >
> > -void media_device_cleanup(struct media_device *mdev)
> > +static void media_device_cleanup(struct media_device *mdev)
> > {
> > ida_destroy(&mdev->entity_internal_idx);
> > mdev->entity_internal_idx_max = 0;
> > media_entity_graph_walk_cleanup(&mdev->pm_count_walk);
> > - mutex_destroy(&mdev->graph_mutex);
>
> Any reason why this is removed? mutex_init() is still called in
> media_device_init() so I believe the destroy should be kept here.
This code is now called only at do_media_device_unregister, with
is protected by the mutex. If we keep the mutex_destroy there,
the mutex will be destroyed in lock state, causing an error if
mutex debug is enabled.
Btw, the standard implementation for the mutex is:
include/linux/mutex.h:static inline void mutex_destroy(struct mutex *lock) {}
Only when mutex debug is enabled, it becomes something else:
include/linux/mutex-debug.h:extern void mutex_destroy(struct mutex *lock);
With produces a warning if the mutex_destroy() is called with the
mutex is hold. This can never happen with the current implementation, as
the logic is:
mutex_lock(&mdev->graph_mutex);
kref_put(&mdev->kref, do_media_device_unregister);
mutex_unlock(&mdev->graph_mutex);
We could eventually move the mutex lock to
do_media_device_unregister() and then add there the mutex_destroy()
Regards,
Mauro
>
> Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
>
> Best regards,
> Javier
--
Thanks,
Mauro
next prev parent reply other threads:[~2016-03-16 14:36 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-16 12:04 [PATCH 1/5] [media] media-device: get rid of the spinlock Mauro Carvalho Chehab
2016-03-16 12:04 ` [PATCH 2/5] [media] media-device: Fix a comment Mauro Carvalho Chehab
2016-03-16 12:58 ` Javier Martinez Canillas
2016-03-16 12:04 ` [PATCH 3/5] [media] au0828: Unregister notifiers Mauro Carvalho Chehab
2016-03-16 13:11 ` Javier Martinez Canillas
2016-03-22 19:55 ` Shuah Khan
2016-03-16 12:04 ` [PATCH 4/5] [media] media-device: use kref for media_device instance Mauro Carvalho Chehab
2016-03-16 13:23 ` Javier Martinez Canillas
2016-03-16 14:05 ` Shuah Khan
2016-03-16 14:25 ` Mauro Carvalho Chehab
2016-03-16 14:32 ` Shuah Khan
2016-03-17 11:50 ` Sakari Ailus
2016-03-18 11:17 ` Mauro Carvalho Chehab
2016-03-18 13:10 ` Sakari Ailus
2016-03-22 19:56 ` Shuah Khan
2016-03-22 20:07 ` Shuah Khan
2016-03-16 12:04 ` [PATCH 5/5] [media] media-device: make media_device_cleanup() static Mauro Carvalho Chehab
2016-03-16 14:03 ` Javier Martinez Canillas
2016-03-16 14:36 ` Mauro Carvalho Chehab [this message]
2016-03-16 14:38 ` Javier Martinez Canillas
2016-03-22 19:57 ` Shuah Khan
2016-03-16 12:53 ` [PATCH 1/5] [media] media-device: get rid of the spinlock Javier Martinez Canillas
2016-03-16 13:10 ` Mauro Carvalho Chehab
2016-03-16 14:10 ` Sakari Ailus
2016-03-22 19:52 ` Shuah Khan
2016-03-24 22:11 ` 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=20160316113625.23f1bf82@recife.lan \
--to=mchehab@osg.samsung.com \
--cc=arnd@arndb.de \
--cc=chehabrafael@gmail.com \
--cc=crope@iki.fi \
--cc=hans.verkuil@cisco.com \
--cc=hyun.kwon@xilinx.com \
--cc=javier@dowhile0.org \
--cc=javier@osg.samsung.com \
--cc=jh1009.sung@samsung.com \
--cc=k.kozlowski@samsung.com \
--cc=kgene@kernel.org \
--cc=kyungmin.park@samsung.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=luis@debethencourt.com \
--cc=mchehab@infradead.org \
--cc=michal.simek@xilinx.com \
--cc=nenggun.kim@samsung.com \
--cc=patrick.boettcher@posteo.de \
--cc=s.nawrocki@samsung.com \
--cc=sakari.ailus@linux.intel.com \
--cc=shuahkh@osg.samsung.com \
--cc=soren.brinkmann@xilinx.com \
--cc=stefanr@s5r6.in-berlin.de \
--cc=sw0312.kim@samsung.com \
--cc=tt.rantala@gmail.com \
--cc=zzam@gentoo.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox