From mboxrd@z Thu Jan 1 00:00:00 1970 Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 12 Aug 2013 18:11:12 +0200 (CEST) Received: from multi.imgtec.com ([194.200.65.239]:47136 "EHLO multi.imgtec.com" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S6822344Ab3HLQLKQKE0l (ORCPT ); Mon, 12 Aug 2013 18:11:10 +0200 Message-ID: <520908DD.9040008@imgtec.com> Date: Mon, 12 Aug 2013 17:10:05 +0100 From: James Hogan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: John Crispin CC: Mark Brown , Gabor Juhos , , Subject: Re: [PATCH 2/2] SPI: ralink: add Ralink SoC spi driver References: <1376074288-29302-1-git-send-email-blogic@openwrt.org> <1376074288-29302-2-git-send-email-blogic@openwrt.org> In-Reply-To: <1376074288-29302-2-git-send-email-blogic@openwrt.org> X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.154.65] X-SEF-Processed: 7_3_0_01192__2013_08_12_17_11_04 Return-Path: X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0) X-Orcpt: rfc822;linux-mips@linux-mips.org Original-Recipient: rfc822;linux-mips@linux-mips.org X-archive-position: 37530 X-ecartis-version: Ecartis v1.0.0 Sender: linux-mips-bounce@linux-mips.org Errors-to: linux-mips-bounce@linux-mips.org X-original-sender: james.hogan@imgtec.com Precedence: bulk List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: linux-mips X-List-ID: linux-mips List-subscribe: List-owner: List-post: List-archive: X-list: linux-mips 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) > +{ > + 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); > + } > +} > + > +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 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from multi.imgtec.com ([194.200.65.239]:47136 "EHLO multi.imgtec.com" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S6822344Ab3HLQLKQKE0l (ORCPT ); Mon, 12 Aug 2013 18:11:10 +0200 Message-ID: <520908DD.9040008@imgtec.com> Date: Mon, 12 Aug 2013 17:10:05 +0100 From: James Hogan MIME-Version: 1.0 Subject: Re: [PATCH 2/2] SPI: ralink: add Ralink SoC spi driver References: <1376074288-29302-1-git-send-email-blogic@openwrt.org> <1376074288-29302-2-git-send-email-blogic@openwrt.org> In-Reply-To: <1376074288-29302-2-git-send-email-blogic@openwrt.org> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Return-Path: Sender: linux-mips-bounce@linux-mips.org Errors-to: linux-mips-bounce@linux-mips.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-subscribe: List-owner: List-post: List-archive: To: John Crispin Cc: Mark Brown , Gabor Juhos , linux-spi@vger.kernel.org, linux-mips@linux-mips.org Message-ID: <20130812161005.W3lddGJ6NsRUpeXMEghMiyGBdaYPtS_Fugo7lQwsdHw@z> 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) > +{ > + 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); > + } > +} > + > +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