Skip to contentSkip to conversation

marvell-ccic: add clock tree support for marvell-ccic driver

PATCH Superseded lbyang 2 participants 3 messages Jun 4, 2013 – Jun 25, 2013 Media (V4L/DVB)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

lbyang

author
#0 lore raw

PATCH 2/7 marvell-ccic: add clock tree support for marvell-ccic driver

From: Libin Yang <[email protected]>

This patch adds the clock tree support for marvell-ccic.

---
 drivers/media/platform/marvell-ccic/mcam-core.h  |    5 +++
 drivers/media/platform/marvell-ccic/mmp-driver.c |   48 ++++++++++++++++++++++
 2 files changed, 53 insertions(+)
drivers/media/platform/marvell-ccic/mcam-core.h +5 -0
index be271b3..c506cd3 100644
@@ -83,6 +83,8 @@ struct mcam_frame_state {
 	unsigned int delivered;
 };
 
+#define NR_MCAM_CLK 3
+
 /*
  * A description of one of our devices.
  * Locking: controlled by s_mutex.  Certain fields, however, require
@@ -113,6 +115,9 @@ struct mcam_camera {
 	bool mipi_enabled;
 	int lane;			/* lane number */
 
+	/* clock tree support */
+	struct clk *clk[NR_MCAM_CLK];
+
 	/*
 	 * Callbacks from the core to the platform code.
 	 */
drivers/media/platform/marvell-ccic/mmp-driver.c +48 -0

89 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#1 lore raw

drivers/media/platform/marvell-ccic/mmp-driver.c static struct mmp_camera *mmpcam_find_device(struct platform_device *pdev) · line 118

Quoted 9 lines · On Tue, 4 Jun 2013 13:42:44 +0800 lbyang <[email protected]> wrote:
drivers/media/platform/marvell-ccic/mmp-driver.c +9 -0
+static void mcam_clk_enable(struct mcam_camera *mcam)
+{
+	unsigned int i;
+
+	for (i = 0; i < NR_MCAM_CLK; i++) {
+		if (!IS_ERR_OR_NULL(mcam->clk[i]))
+			clk_prepare_enable(mcam->clk[i]);
+	}
+}

It seems I already acked this patch, and I won't take that back. I will point out, though, that IS_ERR_OR_NULL has become a sort of lightning rod and that its use is probably best avoided.

	http://lists.infradead.org/pipermail/linux-arm-kernel/2013-January/140543.html

This relates to the use of ERR_PTR with that particular pointer value; I still think just using NULL is better, but maybe I'm missing something.

jon

author
#2 lore raw

Hi Jonathan,

Do you mean using IS_ERR() here directly? I think it should be OK. I will change to IS_ERR() in next version.

Regards,
Libin

Quoted 36 lines

-----Original Message-----
From: Jonathan Corbet [mailto:[email protected]]
Sent: Saturday, June 22, 2013 1:02 AM
To: Libin Yang
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/7] marvell-ccic: add clock tree support for marvell-ccic driver

drivers/media/platform/marvell-ccic/mmp-driver.c static struct mmp_camera *mmpcam_find_device(struct platform_device *pdev) · line 118

Quoted 8 lines · On Tue, 4 Jun 2013 13:42:44 +0800 lbyang <[email protected]> wrote:
drivers/media/platform/marvell-ccic/mmp-driver.c +8 -0
+static void mcam_clk_enable(struct mcam_camera *mcam) {
+	unsigned int i;
+
+	for (i = 0; i < NR_MCAM_CLK; i++) {
+		if (!IS_ERR_OR_NULL(mcam->clk[i]))
+			clk_prepare_enable(mcam->clk[i]);
+	}
+}

It seems I already acked this patch, and I won't take that back. I will point out, though, that IS_ERR_OR_NULL has become a sort of lightning rod and that its use is probably best avoided.

http://lists.infradead.org/pipermail/linux-arm-kernel/2013-Janu
ary/140543.html

This relates to the use of ERR_PTR with that particular pointer value; I still think just using NULL is better, but maybe I'm missing something.

jon