On 09/08/13 19:51, John Crispin wrote:
+#ifdef DEBUG
+#define spi_debug(args...) printk(args)
+#else
+#define spi_debug(args...)
+#endif
This looks a bit like pr_debug. If you have a device pointer around,
there's also a dev_dbg which takes an additional device pointer and
prepends it's name to the message.
+static int rt2880_spi_probe(struct platform_device *pdev)
+{
<snip>
+ clk = devm_clk_get(&pdev->dev, NULL);
+ if (IS_ERR(clk)) {
+ dev_err(&pdev->dev, "unable to get SYS clock, err=%d\n",
+ status);
+ return PTR_ERR(clk);
+ }
<snip>
+}
+
+static int rt2880_spi_remove(struct platform_device *pdev)
+{
+ struct spi_master *master;
+ struct rt2880_spi *rs;
+
+ master = dev_get_drvdata(&pdev->dev);
+ rs = spi_master_get_devdata(master);
+
+ clk_disable(rs->clk);
+ clk_put(rs->clk);
The devm_clk_get in your probe function means you don't need clk_put here.
Cheers
James