From: Li Yang <leoli@freescale.com>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: Gao Pan <b54642@freescale.com>, Li Yang <leoli@freescale.com>,
linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] i2c: imx: fix build issue for platforms without pinctrl
Date: Tue, 17 Nov 2015 15:11:15 -0600 [thread overview]
Message-ID: <1447794675-19411-1-git-send-email-leoli@freescale.com> (raw)
With commit 1c4b6c3b (i2c: imx: implement bus recovery) the driver
starts to use pinctrl to do i2c bus recovery. But this breaks build
for platforms that don't implement pinctrl, such as ls1021a and
ls1043a.
This patch fix the problem by only compiling the bus recovery code
when CONFIG_PINCTRL is enabled.
Reported-by: Ren Xiaofeng <xiaofeng.ren@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
Cc: Gao Pan <b54642@freescale.com>
---
drivers/i2c/busses/i2c-imx.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 1e4d99d..614253a 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -208,11 +208,13 @@ struct imx_i2c_struct {
unsigned int cur_clk;
unsigned int bitrate;
const struct imx_i2c_hwdata *hwdata;
+#ifdef CONFIG_PINCTRL
struct i2c_bus_recovery_info rinfo;
struct pinctrl *pinctrl;
struct pinctrl_state *pinctrl_pins_default;
struct pinctrl_state *pinctrl_pins_gpio;
+#endif
struct imx_i2c_dma *dma;
};
@@ -902,12 +904,14 @@ static int i2c_imx_xfer(struct i2c_adapter *adapter,
/* Start I2C transfer */
result = i2c_imx_start(i2c_imx);
+#ifdef CONFIG_PINCTRL
if (result) {
if (i2c_imx->adapter.bus_recovery_info) {
i2c_recover_bus(&i2c_imx->adapter);
result = i2c_imx_start(i2c_imx);
}
}
+#endif
if (result)
goto fail0;
@@ -969,6 +973,7 @@ fail0:
return (result < 0) ? result : num;
}
+#ifdef CONFIG_PINCTRL
static void i2c_imx_prepare_recovery(struct i2c_adapter *adap)
{
struct imx_i2c_struct *i2c_imx;
@@ -1017,6 +1022,7 @@ static void i2c_imx_init_recovery_info(struct imx_i2c_struct *i2c_imx,
rinfo->recover_bus = i2c_generic_gpio_recovery;
i2c_imx->adapter.bus_recovery_info = rinfo;
}
+#endif
static u32 i2c_imx_func(struct i2c_adapter *adapter)
{
@@ -1086,11 +1092,13 @@ static int i2c_imx_probe(struct platform_device *pdev)
return ret;
}
+#ifdef CONFIG_PINCTRL
i2c_imx->pinctrl = devm_pinctrl_get(&pdev->dev);
if (IS_ERR(i2c_imx->pinctrl)) {
ret = PTR_ERR(i2c_imx->pinctrl);
goto clk_disable;
}
+#endif
/* Request IRQ */
ret = devm_request_irq(&pdev->dev, irq, i2c_imx_isr, 0,
@@ -1125,7 +1133,9 @@ static int i2c_imx_probe(struct platform_device *pdev)
goto clk_disable;
}
+#ifdef CONFIG_PINCTRL
i2c_imx_init_recovery_info(i2c_imx, pdev);
+#endif
/* Set up platform driver data */
platform_set_drvdata(pdev, i2c_imx);
--
2.3.3
next reply other threads:[~2015-11-17 21:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-17 21:11 Li Yang [this message]
2015-11-17 23:00 ` [PATCH] i2c: imx: fix build issue for platforms without pinctrl Li Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1447794675-19411-1-git-send-email-leoli@freescale.com \
--to=leoli@freescale.com \
--cc=b54642@freescale.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox