From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sourav Poddar Subject: Re: [PATCH] i2c: sirf: get the i2c pin group by pinctrl api Date: Mon, 18 Mar 2013 13:31:10 +0530 Message-ID: <5146C9C6.2030507@ti.com> References: <1363591361-5992-1-git-send-email-Barry.Song@csr.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1363591361-5992-1-git-send-email-Barry.Song-kQvG35nSl+M@public.gmane.org> Sender: linux-i2c-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Barry Song Cc: w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org, ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, workgroup.linux-kQvG35nSl+M@public.gmane.org, Barry Song , Linus Walleij List-Id: linux-i2c@vger.kernel.org Hi, On Monday 18 March 2013 12:52 PM, Barry Song wrote: > From: Barry Song > > hardcode set i2c pin group to i2c function before, here we > move to use standard pinctrl API to get pins of the group. > > Signed-off-by: Barry Song > Cc: Linus Walleij > --- > drivers/i2c/busses/i2c-sirf.c | 9 +++++++++ > 1 files changed, 9 insertions(+), 0 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-sirf.c b/drivers/i2c/busses/i2c-sirf.c > index 5a7ad24..dd4004e 100644 > --- a/drivers/i2c/busses/i2c-sirf.c > +++ b/drivers/i2c/busses/i2c-sirf.c > @@ -16,6 +16,7 @@ > #include > #include > #include > +#include > > #define SIRFSOC_I2C_CLK_CTRL 0x00 > #define SIRFSOC_I2C_STATUS 0x0C > @@ -265,6 +266,7 @@ static int i2c_sirfsoc_probe(struct platform_device *pdev) > struct i2c_adapter *adap; > struct resource *mem_res; > struct clk *clk; > + struct pinctrl *pinctrl; > int bitrate; > int ctrl_speed; > int irq; > @@ -272,6 +274,12 @@ static int i2c_sirfsoc_probe(struct platform_device *pdev) > int err; > u32 regval; > > + pinctrl = devm_pinctrl_get_select_default(&pdev->dev); > + if (IS_ERR(pinctrl)) { > + err = PTR_ERR(pinctrl); > + goto failed_pin; > + } > + I think, you should also add an "EPROBE_DEFER" check here ? > clk = clk_get(&pdev->dev, NULL); > if (IS_ERR(clk)) { > err = PTR_ERR(clk); > @@ -385,6 +393,7 @@ err_clk_en: > err_clk_prep: > clk_put(clk); > err_get_clk: > +failed_pin: > return err; > } >