Message ID | 1451911723-10868-1-git-send-email-wsa@the-dreams.de (mailing list archive) |
---|---|
State | Accepted, archived |
Delegated to: | Guennadi Liakhovetski |
Headers |
Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.84) (envelope-from <linux-media-owner@vger.kernel.org>) id 1aG4ZK-0005y4-Kn; Mon, 04 Jan 2016 12:49:02 +0000 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.76/mailfrontend-8) with esmtp id 1aG4ZI-0008Lw-lT; Mon, 04 Jan 2016 13:49:02 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753599AbcADMs5 (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Mon, 4 Jan 2016 07:48:57 -0500 Received: from sauhun.de ([89.238.76.85]:45320 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753251AbcADMs4 (ORCPT <rfc822;linux-media@vger.kernel.org>); Mon, 4 Jan 2016 07:48:56 -0500 Received: from p4fe24e64.dip0.t-ipconnect.de ([79.226.78.100]:44241 helo=localhost) by pokefinder.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <wsa@the-dreams.de>) id 1aG4ZB-0006cm-VH; Mon, 04 Jan 2016 13:48:54 +0100 From: Wolfram Sang <wsa@the-dreams.de> To: linux-sh@vger.kernel.org Cc: Wolfram Sang <wsa@the-dreams.de>, Guennadi Liakhovetski <g.liakhovetski@gmx.de>, Mauro Carvalho Chehab <mchehab@osg.samsung.com>, linux-media@vger.kernel.org Subject: [PATCH] soc_camera: cleanup control device on async_unbind Date: Mon, 4 Jan 2016 13:48:24 +0100 Message-Id: <1451911723-10868-1-git-send-email-wsa@the-dreams.de> X-Mailer: git-send-email 2.1.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2016.1.4.124216 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODY_SIZE_3000_3999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, NO_URI_HTTPS 0, SINGLE_URI_IN_BODY 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __FRAUD_CONTACT_NAME 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __SINGLE_URI_TEXT 0, __STOCK_PHRASE_24 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_IN_BODY 0, __URI_NO_WWW 0, __URI_NS ' |
Commit Message
Wolfram Sang
Jan. 4, 2016, 12:48 p.m. UTC
From: Wolfram Sang <wsa+renesas@sang-engineering.com> I got the following WARN on a simple unbind/bind cycle: root@Lager:/sys/bus/i2c/drivers/adv7180# echo 6-0020 > unbind root@Lager:/sys/bus/i2c/drivers/adv7180# echo 6-0020 > bind [ 31.097652] adv7180 6-0020: chip found @ 0x20 (e6520000.i2c) [ 31.123744] ------------[ cut here ]------------ [ 31.128413] WARNING: CPU: 3 PID: 873 at drivers/media/platform/soc_camera/soc_camera.c:1463 soc_camera_async_bound+0x40/0xa0() [ 31.139896] CPU: 3 PID: 873 Comm: sh Not tainted 4.4.0-rc3-00062-ge8ae2c0b6bca2a #172 [ 31.147815] Hardware name: Generic R8A7790 (Flattened Device Tree) [ 31.154056] Backtrace: [ 31.156575] [<c0014bc0>] (dump_backtrace) from [<c0014d80>] (show_stack+0x20/0x24) [ 31.164233] r6:c05c5b33 r5:00000009 r4:00000000 r3:00404100 [ 31.170017] [<c0014d60>] (show_stack) from [<c01e2344>] (dump_stack+0x78/0x94) [ 31.177344] [<c01e22cc>] (dump_stack) from [<c0029e7c>] (warn_slowpath_common+0x98/0xc4) [ 31.185518] r4:00000000 r3:00000000 [ 31.189172] [<c0029de4>] (warn_slowpath_common) from [<c0029fa0>] (warn_slowpath_null+0x2c/0x34) [ 31.198043] r8:eb38df28 r7:eb38c5d0 r6:eb38de80 r5:e6962810 r4:eb38de80 [ 31.204898] [<c0029f74>] (warn_slowpath_null) from [<c0356348>] (soc_camera_async_bound+0x40/0xa0) [ 31.213955] [<c0356308>] (soc_camera_async_bound) from [<c03499a0>] (v4l2_async_test_notify+0x9c/0x108) [ 31.223430] r5:eb38c5ec r4:eb38de80 [ 31.227084] [<c0349904>] (v4l2_async_test_notify) from [<c0349dd8>] (v4l2_async_register_subdev+0x88/0xd0) [ 31.236822] r7:c07115c8 r6:c071160c r5:eb38c5ec r4:eb38de80 [ 31.242622] [<c0349d50>] (v4l2_async_register_subdev) from [<c0337040>] (adv7180_probe+0x2c8/0x3a4) [ 31.251753] r8:00000000 r7:00000001 r6:eb38de80 r5:ea973400 r4:eb38de10 r3:00000000 [ 31.259660] [<c0336d78>] (adv7180_probe) from [<c032dd80>] (i2c_device_probe+0x1a0/0x1e4) This gets fixed by clearing the control device pointer on async_unbind. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> --- I stumbled over this while playing with OF_DYNAMIC and rebinding various devices through that. I have to admit I am not actually using the camera interface besides binding to it. This shouldn't make a difference, though :) Stable material, I'd think. drivers/media/platform/soc_camera/soc_camera.c | 2 ++ 1 file changed, 2 insertions(+)
Comments
Hi Wolfram, Thanks for the patch! From looking at it, I agree, that this looks like a fix, and I even would recommend it for stable, but - at least for that I'd like this patch to actually be tested! At least if someone could try to use the camera after such a unbind / bind cycle. Would you be able to test this? Until then I'll just push this for the forthcoming 4.5. Thanks Guennadi On Mon, 4 Jan 2016, Wolfram Sang wrote: > From: Wolfram Sang <wsa+renesas@sang-engineering.com> > > I got the following WARN on a simple unbind/bind cycle: > > root@Lager:/sys/bus/i2c/drivers/adv7180# echo 6-0020 > unbind > root@Lager:/sys/bus/i2c/drivers/adv7180# echo 6-0020 > bind > [ 31.097652] adv7180 6-0020: chip found @ 0x20 (e6520000.i2c) > [ 31.123744] ------------[ cut here ]------------ > [ 31.128413] WARNING: CPU: 3 PID: 873 at drivers/media/platform/soc_camera/soc_camera.c:1463 soc_camera_async_bound+0x40/0xa0() > [ 31.139896] CPU: 3 PID: 873 Comm: sh Not tainted 4.4.0-rc3-00062-ge8ae2c0b6bca2a #172 > [ 31.147815] Hardware name: Generic R8A7790 (Flattened Device Tree) > [ 31.154056] Backtrace: > [ 31.156575] [<c0014bc0>] (dump_backtrace) from [<c0014d80>] (show_stack+0x20/0x24) > [ 31.164233] r6:c05c5b33 r5:00000009 r4:00000000 r3:00404100 > [ 31.170017] [<c0014d60>] (show_stack) from [<c01e2344>] (dump_stack+0x78/0x94) > [ 31.177344] [<c01e22cc>] (dump_stack) from [<c0029e7c>] (warn_slowpath_common+0x98/0xc4) > [ 31.185518] r4:00000000 r3:00000000 > [ 31.189172] [<c0029de4>] (warn_slowpath_common) from [<c0029fa0>] (warn_slowpath_null+0x2c/0x34) > [ 31.198043] r8:eb38df28 r7:eb38c5d0 r6:eb38de80 r5:e6962810 r4:eb38de80 > [ 31.204898] [<c0029f74>] (warn_slowpath_null) from [<c0356348>] (soc_camera_async_bound+0x40/0xa0) > [ 31.213955] [<c0356308>] (soc_camera_async_bound) from [<c03499a0>] (v4l2_async_test_notify+0x9c/0x108) > [ 31.223430] r5:eb38c5ec r4:eb38de80 > [ 31.227084] [<c0349904>] (v4l2_async_test_notify) from [<c0349dd8>] (v4l2_async_register_subdev+0x88/0xd0) > [ 31.236822] r7:c07115c8 r6:c071160c r5:eb38c5ec r4:eb38de80 > [ 31.242622] [<c0349d50>] (v4l2_async_register_subdev) from [<c0337040>] (adv7180_probe+0x2c8/0x3a4) > [ 31.251753] r8:00000000 r7:00000001 r6:eb38de80 r5:ea973400 r4:eb38de10 r3:00000000 > [ 31.259660] [<c0336d78>] (adv7180_probe) from [<c032dd80>] (i2c_device_probe+0x1a0/0x1e4) > > This gets fixed by clearing the control device pointer on async_unbind. > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> > --- > > I stumbled over this while playing with OF_DYNAMIC and rebinding various > devices through that. I have to admit I am not actually using the camera > interface besides binding to it. This shouldn't make a difference, though :) > > Stable material, I'd think. > > drivers/media/platform/soc_camera/soc_camera.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c > index dc98122e78dc50..361275c9f770d7 100644 > --- a/drivers/media/platform/soc_camera/soc_camera.c > +++ b/drivers/media/platform/soc_camera/soc_camera.c > @@ -1493,6 +1493,8 @@ static void soc_camera_async_unbind(struct v4l2_async_notifier *notifier, > struct soc_camera_async_client, notifier); > struct soc_camera_device *icd = platform_get_drvdata(sasc->pdev); > > + icd->control = NULL; > + > if (icd->clk) { > v4l2_clk_unregister(icd->clk); > icd->clk = NULL; > -- > 2.1.4 > -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> Thanks for the patch! From looking at it, I agree, that this looks like a > fix, and I even would recommend it for stable, but - at least for that I'd > like this patch to actually be tested! At least if someone could try to > use the camera after such a unbind / bind cycle. Would you be able to test > this? Until then I'll just push this for the forthcoming 4.5. I'll try to get it tested. Thanks, Wolfram
> this? Until then I'll just push this for the forthcoming 4.5.
Come to think of it: I don't have the setup to test this, and the people
which have that are hopefully off for the weekend. Since 4.4 is to be
released on Sunday anyhow, 4.5 sounds just fine to me.
* Wolfram Sang <wsa@the-dreams.de> [2016-01-04 13:48:24 +0100]: > From: Wolfram Sang <wsa+renesas@sang-engineering.com> > > I got the following WARN on a simple unbind/bind cycle: > > root@Lager:/sys/bus/i2c/drivers/adv7180# echo 6-0020 > unbind > root@Lager:/sys/bus/i2c/drivers/adv7180# echo 6-0020 > bind > [ 31.097652] adv7180 6-0020: chip found @ 0x20 (e6520000.i2c) > [ 31.123744] ------------[ cut here ]------------ > [ 31.128413] WARNING: CPU: 3 PID: 873 at drivers/media/platform/soc_camera/soc_camera.c:1463 soc_camera_async_bound+0x40/0xa0() > [ 31.139896] CPU: 3 PID: 873 Comm: sh Not tainted 4.4.0-rc3-00062-ge8ae2c0b6bca2a #172 > [ 31.147815] Hardware name: Generic R8A7790 (Flattened Device Tree) > [ 31.154056] Backtrace: > [ 31.156575] [<c0014bc0>] (dump_backtrace) from [<c0014d80>] (show_stack+0x20/0x24) > [ 31.164233] r6:c05c5b33 r5:00000009 r4:00000000 r3:00404100 > [ 31.170017] [<c0014d60>] (show_stack) from [<c01e2344>] (dump_stack+0x78/0x94) > [ 31.177344] [<c01e22cc>] (dump_stack) from [<c0029e7c>] (warn_slowpath_common+0x98/0xc4) > [ 31.185518] r4:00000000 r3:00000000 > [ 31.189172] [<c0029de4>] (warn_slowpath_common) from [<c0029fa0>] (warn_slowpath_null+0x2c/0x34) > [ 31.198043] r8:eb38df28 r7:eb38c5d0 r6:eb38de80 r5:e6962810 r4:eb38de80 > [ 31.204898] [<c0029f74>] (warn_slowpath_null) from [<c0356348>] (soc_camera_async_bound+0x40/0xa0) > [ 31.213955] [<c0356308>] (soc_camera_async_bound) from [<c03499a0>] (v4l2_async_test_notify+0x9c/0x108) > [ 31.223430] r5:eb38c5ec r4:eb38de80 > [ 31.227084] [<c0349904>] (v4l2_async_test_notify) from [<c0349dd8>] (v4l2_async_register_subdev+0x88/0xd0) > [ 31.236822] r7:c07115c8 r6:c071160c r5:eb38c5ec r4:eb38de80 > [ 31.242622] [<c0349d50>] (v4l2_async_register_subdev) from [<c0337040>] (adv7180_probe+0x2c8/0x3a4) > [ 31.251753] r8:00000000 r7:00000001 r6:eb38de80 r5:ea973400 r4:eb38de10 r3:00000000 > [ 31.259660] [<c0336d78>] (adv7180_probe) from [<c032dd80>] (i2c_device_probe+0x1a0/0x1e4) > > This gets fixed by clearing the control device pointer on async_unbind. > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Tested on Koelsch and the camera works fine after a unbind/bind operation. > --- > > I stumbled over this while playing with OF_DYNAMIC and rebinding various > devices through that. I have to admit I am not actually using the camera > interface besides binding to it. This shouldn't make a difference, though :) > > Stable material, I'd think. > > drivers/media/platform/soc_camera/soc_camera.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c > index dc98122e78dc50..361275c9f770d7 100644 > --- a/drivers/media/platform/soc_camera/soc_camera.c > +++ b/drivers/media/platform/soc_camera/soc_camera.c > @@ -1493,6 +1493,8 @@ static void soc_camera_async_unbind(struct v4l2_async_notifier *notifier, > struct soc_camera_async_client, notifier); > struct soc_camera_device *icd = platform_get_drvdata(sasc->pdev); > > + icd->control = NULL; > + > if (icd->clk) { > v4l2_clk_unregister(icd->clk); > icd->clk = NULL; > -- > 2.1.4 > -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> > This gets fixed by clearing the control device pointer on async_unbind. > > > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> > > Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> > > Tested on Koelsch and the camera works fine after a unbind/bind > operation. Thanks a lot, Niklas!
diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index dc98122e78dc50..361275c9f770d7 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -1493,6 +1493,8 @@ static void soc_camera_async_unbind(struct v4l2_async_notifier *notifier, struct soc_camera_async_client, notifier); struct soc_camera_device *icd = platform_get_drvdata(sasc->pdev); + icd->control = NULL; + if (icd->clk) { v4l2_clk_unregister(icd->clk); icd->clk = NULL;