Thread (10 messages) 10 messages, 3 authors, 2011-04-29
DORMANTno replies

[PATCH v6 1/3] MTD : add the common code for GPMI controller driver

From: Huang Shijie <hidden>
Date: 2011-04-29 01:42:20

hi:
On Wed, Apr 20, 2011 at 10:45:47AM +0800, Huang Shijie wrote:
quoted
+static inline int acquire_clock(struct gpmi_nfc_data *this, struct clk **clock)
+{
+	struct clk *c;
+
+	c = clk_get(&this->pdev->dev, NULL);
+	if (IS_ERR(c)) {
+		log("Can't own clock");
+		return PTR_ERR(c);
+	}
+	*clock = c;
+	return 0;
+}
+
+static void release_clock(struct gpmi_nfc_data *this, struct clk *clock)
+{
+	clk_put(clock);
+}
Do you really need to abstract like this?  It appears to just complicate
the code unnecessarily.
ok, I can remove the two functions.
quoted
+#define log(a, ...) printk(KERN_INFO "[ %s : %.3d ] "a"\n", \
+			__func__, __LINE__,  ## __VA_ARGS__)
Also, I don't like this log() function.  You can do the same with:

#define pr_fmt(fmt) "[ %s : %.3d ] " fmt, __func__, __LINE__

and use pr_info() instead.  Note that it's generally frowned upon to
hide the \n inside the pr_fmt().
ok, I will change it.

Thanks .


Best Regards
Huang Shijie
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help