From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2680C4361B for ; Wed, 9 Dec 2020 14:07:01 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4A7BD23B40 for ; Wed, 9 Dec 2020 14:07:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4A7BD23B40 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=n1oLjomSXX2otmTH0xxHVh2WYXsCv7XyChqMAKf2F4o=; b=1t/Zuf+dKUpyu3tWQht8LFPKr FxZWB9U52usKvpcNAnObTxU62PproD1xMUhwmR5DwBqYJVHvO32VEWcdadk4fEL3kLwqLs3bG4OP+ FA1hCahZKjH0BrwA54aykMlmlfhzTRh0K+TcTIROhpp8tXEsFEz+fPe8TK2edSVfe4V7eqFkyR4Lp Ut/G5Wr60+b9tGb/H4uf3Hmv+PMVKvupI8EOSPs7E3gF7iewH/NkM1gA23IrkjanwWo/FPytc1VN0 mvoC9fj4SUZCYMiIhBGXlhp1kINt0GX0VoPFCFtfderpPIxRr6dkUJMU5tr6hU7mea+/Dwj/B2v58 GaiH7H/rA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kn069-0001h4-5b; Wed, 09 Dec 2020 14:05:41 +0000 Received: from relay2-d.mail.gandi.net ([217.70.183.194]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kn065-0001fC-LA for linux-arm-kernel@lists.infradead.org; Wed, 09 Dec 2020 14:05:39 +0000 X-Originating-IP: 93.29.109.196 Received: from aptenodytes (196.109.29.93.rev.sfr.net [93.29.109.196]) (Authenticated sender: paul.kocialkowski@bootlin.com) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id B2C974000A; Wed, 9 Dec 2020 14:05:29 +0000 (UTC) Date: Wed, 9 Dec 2020 15:05:28 +0100 From: Paul Kocialkowski To: Sakari Ailus Subject: Re: [PATCH v4 2/2] media: i2c: Add support for the OV5648 image sensor Message-ID: References: <20201128143350.531460-1-paul.kocialkowski@bootlin.com> <20201128143350.531460-3-paul.kocialkowski@bootlin.com> <20201208233436.GF25763@paasikivi.fi.intel.com> MIME-Version: 1.0 In-Reply-To: <20201208233436.GF25763@paasikivi.fi.intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201209_090537_921980_CE888E0F X-CRM114-Status: GOOD ( 19.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Maxime Ripard , Hans Verkuil , Rob Herring , Thomas Petazzoni , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Content-Type: multipart/mixed; boundary="===============0542351673269096783==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============0542351673269096783== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="x/BLB4o4zfTOQ4w3" Content-Disposition: inline --x/BLB4o4zfTOQ4w3 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Sakari, On Wed 09 Dec 20, 01:34, Sakari Ailus wrote: > Hi Paul, >=20 > On Sat, Nov 28, 2020 at 03:33:50PM +0100, Paul Kocialkowski wrote: > ... > > + if (ret) > > + goto error_ctrls; > > + > > + /* V4L2 subdev register */ > > + > > + ret =3D v4l2_async_register_subdev_sensor_common(subdev); >=20 > The driver's device node may be already available to the user here... >=20 > > + if (ret) > > + goto error_ctrls; > > + > > + /* Runtime PM */ > > + > > + pm_runtime_enable(sensor->dev); > > + pm_runtime_set_suspended(sensor->dev); >=20 > but runtime PM is enabled here. >=20 > This needs to be done in a different order. Otherwise chances are that the > device node is accessed before the device is powered on. Oh that makes sense yes. Good catch :) > > + > > + return 0; > > + > > +error_ctrls: > > + v4l2_ctrl_handler_free(&sensor->ctrls.handler); > > + > > +error_mutex: > > + mutex_destroy(&sensor->mutex); > > + > > +error_entity: > > + media_entity_cleanup(&sensor->subdev.entity); > > + > > +error_endpoint: > > + v4l2_fwnode_endpoint_free(&sensor->endpoint); > > + > > + return ret; > > +} > > + > > +static int ov5648_remove(struct i2c_client *client) > > +{ > > + struct v4l2_subdev *subdev =3D i2c_get_clientdata(client); > > + struct ov5648_sensor *sensor =3D ov5648_subdev_sensor(subdev); > > + > > + clk_rate_exclusive_put(sensor->xvclk); > > + > > + v4l2_async_unregister_subdev(subdev); > > + mutex_destroy(&sensor->mutex); > > + media_entity_cleanup(&subdev->entity); > > + v4l2_device_unregister_subdev(subdev); > > + pm_runtime_disable(sensor->dev); > > + > > + ov5648_sensor_power(sensor, false); >=20 > This needs to go, too, as there's no corresponding operation that powered > on the device. >=20 > Also don't forget to release the control handler. >=20 > I believe these apply to both of the two drivers. Fair enough and I think runtime PM will have called that already anyways. Cheers, Paul --=20 Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com --x/BLB4o4zfTOQ4w3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEJZpWjZeIetVBefti3cLmz3+fv9EFAl/Q2agACgkQ3cLmz3+f v9EddAf/V6dLv0Ik+tbj8DRMf4Je1cUsBspVDmOWLY2JcKkYf3TIZLl6oN82BL7C JufH3T6zQ9OXK7AaFCks7Q6dO3Do5V1/JbrKBa+rYXc7otmY/j5sg5J4nRSjNRqg e+dCVge2qH9wPv0TIDaxVi34QhT7qPm4BsazJHOGVQXK6JFvw0qU3IBsfxL9QXkl N1Knq7sP7/2SnwATahb1lcD2C1zPgndO0YGiBlE4Z3K298Pwk9JWRBZETucnKjod payiCyV5QV9miDjobSTtQEMgtnLZlfhrQkGmK7Q4/c9vWhwJ10kGB1b4W9sV5geu +p5lnS302RllgZTjjB1AGRXsht6OrQ== =Ecq2 -----END PGP SIGNATURE----- --x/BLB4o4zfTOQ4w3-- --===============0542351673269096783== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============0542351673269096783==--