mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: unlisted-recipients:; (no To-header on input)
Cc: linuxarm@huawei.com, mauro.chehab@huawei.com,
	Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	"Lad, Prabhakar" <prabhakar.csengg@gmail.com>,
	Bingbu Cao <bingbu.cao@intel.com>,
	Chiranjeevi Rapolu <chiranjeevi.rapolu@intel.com>,
	Dave Stevenson <dave.stevenson@raspberrypi.com>,
	Dongchun Zhu <dongchun.zhu@mediatek.com>,
	Hyungwoo Yang <hyungwoo.yang@intel.com>,
	Jacopo Mondi <jacopo@jmondi.org>,
	Leon Luo <leonl@leopardimaging.com>,
	Manivannan Sadhasivam <mani@kernel.org>,
	Matt Ranostay <matt.ranostay@konsulko.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Ricardo Ribalda <ribalda@kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Shawn Tu <shawnx.tu@intel.com>,
	Shunqian Zheng <zhengsq@rock-chips.com>,
	Tianshu Qiu <tian.shu.qiu@intel.com>,
	Wenyou Yang <wenyou.yang@microchip.com>,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org
Subject: [PATCH v5 00/30] media: i2c: use pm_runtime_resume_and_get() were possible
Date: Thu,  6 May 2021 17:22:56 +0200	[thread overview]
Message-ID: <cover.1620314098.git.mchehab+huawei@kernel.org> (raw)

Dealing with PM runtime (RPM) is different than dealing with other kAPIs used
on media, as most pm_runtime_get_*() functions won't return to the the state
before the call if an error rises. They, instead, increment an usage_count.

Due to that, there were several bugs on media. Just on this review, we found
24 such errors.

So, let's use pm_runtime_resume_and_get() whenever possible, as it
has two advantages over :

1. On errors, it decrements the usage count;
2. It always return zero on success or an error code. This prevents a 
   common error pattern of checking if ret is not zero to identify
   for errors.

There are however a few places where calls to pm_runtime_get_sync()
are kept. On several of those, a comment was added, in order to
help preventing trivial patches that could try to change them.

PS.: This series was submitted already together with the fix patches
at:

	https://lore.kernel.org/linux-media/cover.1619621413.git.mchehab+huawei@kernel.org/

I opted to break it on 3 parts, in order to make easier to review.

This is the second part.

Mauro Carvalho Chehab (30):
  media: i2c: ak7375: use pm_runtime_resume_and_get()
  media: i2c: dw9714: use pm_runtime_resume_and_get()
  media: i2c: dw9768: use pm_runtime_resume_and_get()
  media: i2c: dw9807-vcm: use pm_runtime_resume_and_get()
  media: i2c: hi556: use pm_runtime_resume_and_get()
  media: i2c: imx214: use pm_runtime_resume_and_get()
  media: i2c: imx219: use pm_runtime_resume_and_get()
  media: i2c: imx258: use pm_runtime_resume_and_get()
  media: i2c: imx274: use pm_runtime_resume_and_get()
  media: i2c: imx290: use pm_runtime_resume_and_get()
  media: i2c: imx319: use pm_runtime_resume_and_get()
  media: i2c: imx355: use pm_runtime_resume_and_get()
  media: i2c: mt9m001: use pm_runtime_resume_and_get()
  media: i2c: ov02a10: use pm_runtime_resume_and_get()
  media: i2c: ov13858: use pm_runtime_resume_and_get()
  media: i2c: ov2659: use pm_runtime_resume_and_get()
  media: i2c: ov2685: use pm_runtime_resume_and_get()
  media: i2c: ov2740: use pm_runtime_resume_and_get()
  media: i2c: ov5647: use pm_runtime_resume_and_get()
  media: i2c: ov5648: use pm_runtime_resume_and_get()
  media: i2c: ov5670: use pm_runtime_resume_and_get()
  media: i2c: ov5675: use pm_runtime_resume_and_get()
  media: i2c: ov5695: use pm_runtime_resume_and_get()
  media: i2c: ov7740: use pm_runtime_resume_and_get()
  media: i2c: ov8856: use pm_runtime_resume_and_get()
  media: i2c: ov8865: use pm_runtime_resume_and_get()
  media: i2c: ov9734: use pm_runtime_resume_and_get()
  media: i2c: tvp5150: use pm_runtime_resume_and_get()
  media: i2c: video-i2c: use pm_runtime_resume_and_get()
  media: i2c: ccs-core: use pm_runtime_resume_and_get()

 drivers/media/i2c/ak7375.c       | 10 +---------
 drivers/media/i2c/ccs/ccs-core.c |  7 ++-----
 drivers/media/i2c/dw9714.c       | 10 +---------
 drivers/media/i2c/dw9768.c       | 10 +---------
 drivers/media/i2c/dw9807-vcm.c   | 10 +---------
 drivers/media/i2c/hi556.c        |  3 +--
 drivers/media/i2c/imx214.c       |  6 ++----
 drivers/media/i2c/imx219.c       |  6 ++----
 drivers/media/i2c/imx258.c       |  6 ++----
 drivers/media/i2c/imx274.c       |  3 +--
 drivers/media/i2c/imx290.c       |  6 ++----
 drivers/media/i2c/imx319.c       |  6 ++----
 drivers/media/i2c/imx355.c       |  6 ++----
 drivers/media/i2c/mt9m001.c      |  9 +++++++--
 drivers/media/i2c/ov02a10.c      |  6 ++----
 drivers/media/i2c/ov13858.c      |  6 ++----
 drivers/media/i2c/ov2659.c       |  6 ++----
 drivers/media/i2c/ov2685.c       |  7 +++----
 drivers/media/i2c/ov2740.c       |  6 ++----
 drivers/media/i2c/ov5647.c       |  9 +++++----
 drivers/media/i2c/ov5648.c       |  6 ++----
 drivers/media/i2c/ov5670.c       |  6 ++----
 drivers/media/i2c/ov5675.c       |  3 +--
 drivers/media/i2c/ov5695.c       |  6 ++----
 drivers/media/i2c/ov7740.c       |  6 ++----
 drivers/media/i2c/ov8856.c       |  3 +--
 drivers/media/i2c/ov8865.c       |  6 ++----
 drivers/media/i2c/ov9734.c       |  3 +--
 drivers/media/i2c/tvp5150.c      | 16 +++-------------
 drivers/media/i2c/video-i2c.c    | 12 ++++--------
 30 files changed, 63 insertions(+), 142 deletions(-)

-- 
2.30.2



             reply	other threads:[~2021-05-06 15:24 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-06 15:22 Mauro Carvalho Chehab [this message]
2021-05-06 15:22 ` [PATCH v5 01/30] media: i2c: ak7375: use pm_runtime_resume_and_get() Mauro Carvalho Chehab
2021-05-06 15:22 ` [PATCH v5 02/30] media: i2c: dw9714: " Mauro Carvalho Chehab
2021-05-06 15:22 ` [PATCH v5 03/30] media: i2c: dw9768: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 04/30] media: i2c: dw9807-vcm: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 05/30] media: i2c: hi556: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 06/30] media: i2c: imx214: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 07/30] media: i2c: imx219: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 08/30] media: i2c: imx258: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 09/30] media: i2c: imx274: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 10/30] media: i2c: imx290: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 11/30] media: i2c: imx319: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 12/30] media: i2c: imx355: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 13/30] media: i2c: mt9m001: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 14/30] media: i2c: ov02a10: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 15/30] media: i2c: ov13858: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 16/30] media: i2c: ov2659: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 17/30] media: i2c: ov2685: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 18/30] media: i2c: ov2740: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 19/30] media: i2c: ov5647: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 20/30] media: i2c: ov5648: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 21/30] media: i2c: ov5670: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 22/30] media: i2c: ov5675: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 23/30] media: i2c: ov5695: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 24/30] media: i2c: ov7740: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 25/30] media: i2c: ov8856: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 26/30] media: i2c: ov8865: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 27/30] media: i2c: ov9734: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 28/30] media: i2c: tvp5150: " Mauro Carvalho Chehab
2021-05-06 15:23 ` [PATCH v5 29/30] media: i2c: video-i2c: " Mauro Carvalho Chehab
2021-05-07 21:26   ` Matt Ranostay
2021-05-06 15:23 ` [PATCH v5 30/30] media: i2c: ccs-core: " Mauro Carvalho Chehab

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=cover.1620314098.git.mchehab+huawei@kernel.org \
    --to=mchehab+huawei@kernel.org \
    --cc=bingbu.cao@intel.com \
    --cc=chiranjeevi.rapolu@intel.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=dongchun.zhu@mediatek.com \
    --cc=hyungwoo.yang@intel.com \
    --cc=jacopo@jmondi.org \
    --cc=leonl@leopardimaging.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mani@kernel.org \
    --cc=matt.ranostay@konsulko.com \
    --cc=mauro.chehab@huawei.com \
    --cc=mchehab@kernel.org \
    --cc=prabhakar.csengg@gmail.com \
    --cc=ribalda@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=shawnx.tu@intel.com \
    --cc=tian.shu.qiu@intel.com \
    --cc=wenyou.yang@microchip.com \
    --cc=zhengsq@rock-chips.com \
    /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

all inboxes | Powered by JetHome®