* [PATCH 1/3] i2c: xilinx: Fix i2c sparse warnings
@ 2013-09-30 9:08 Michal Simek
[not found] ` <c122ad49b27406ee495ef0d6cac191968d64f09f.1380532113.git.michal.simek-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Michal Simek @ 2013-09-30 9:08 UTC (permalink / raw)
To: linux-kernel, monstr
Cc: Kedareswara rao Appana, Wolfram Sang, Kedareswara rao Appana,
Jean Delvare, Peter Korsgaard, linux-i2c
[-- Attachment #1: Type: text/plain, Size: 2530 bytes --]
From: Kedareswara rao Appana <appana.durga.rao@xilinx.com>
code changes to fix sparse warnings
Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
drivers/i2c/busses/i2c-xiic.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index 4c8b368..5eb0a8b 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -68,7 +68,7 @@ struct xiic_i2c {
struct i2c_adapter adap;
struct i2c_msg *tx_msg;
spinlock_t lock;
- unsigned int tx_pos;
+ unsigned int tx_pos;
unsigned int nmsgs;
enum xilinx_i2c_state state;
struct i2c_msg *rx_msg;
@@ -271,11 +271,8 @@ static void xiic_read_rx(struct xiic_i2c *i2c)
bytes_in_fifo = xiic_getreg8(i2c, XIIC_RFO_REG_OFFSET) + 1;
- dev_dbg(i2c->adap.dev.parent, "%s entry, bytes in fifo: %d, msg: %d"
- ", SR: 0x%x, CR: 0x%x\n",
- __func__, bytes_in_fifo, xiic_rx_space(i2c),
- xiic_getreg8(i2c, XIIC_SR_REG_OFFSET),
- xiic_getreg8(i2c, XIIC_CR_REG_OFFSET));
+ dev_dbg(i2c->adap.dev.parent, "%s entry, bytes in fifo: %d, msg: %d",
+ __func__, bytes_in_fifo, xiic_rx_space(i2c));
if (bytes_in_fifo > xiic_rx_space(i2c))
bytes_in_fifo = xiic_rx_space(i2c);
@@ -339,9 +336,10 @@ static void xiic_process(struct xiic_i2c *i2c)
ier = xiic_getreg32(i2c, XIIC_IIER_OFFSET);
pend = isr & ier;
- dev_dbg(i2c->adap.dev.parent, "%s entry, IER: 0x%x, ISR: 0x%x, "
- "pend: 0x%x, SR: 0x%x, msg: %p, nmsgs: %d\n",
- __func__, ier, isr, pend, xiic_getreg8(i2c, XIIC_SR_REG_OFFSET),
+ dev_dbg(i2c->adap.dev.parent, "%s: IER: 0x%x, ISR: 0x%x, pend: 0x%x\n",
+ __func__, ier, isr, pend);
+ dev_dbg(i2c->adap.dev.parent, "%s: SR: 0x%x, msg: %p, nmsgs: %d\n",
+ __func__, xiic_getreg8(i2c, XIIC_SR_REG_OFFSET),
i2c->tx_msg, i2c->nmsgs);
/* Do not processes a devices interrupts if the device has no
@@ -541,9 +539,10 @@ static void xiic_start_send(struct xiic_i2c *i2c)
xiic_irq_clr(i2c, XIIC_INTR_TX_ERROR_MASK);
- dev_dbg(i2c->adap.dev.parent, "%s entry, msg: %p, len: %d, "
- "ISR: 0x%x, CR: 0x%x\n",
- __func__, msg, msg->len, xiic_getreg32(i2c, XIIC_IISR_OFFSET),
+ dev_dbg(i2c->adap.dev.parent, "%s entry, msg: %p, len: %d",
+ __func__, msg, msg->len);
+ dev_dbg(i2c->adap.dev.parent, "%s entry, ISR: 0x%x, CR: 0x%x\n",
+ __func__, xiic_getreg32(i2c, XIIC_IISR_OFFSET),
xiic_getreg8(i2c, XIIC_CR_REG_OFFSET));
if (!(msg->flags & I2C_M_NOSTART)) {
--
1.8.2.3
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply related [flat|nested] 7+ messages in thread[parent not found: <c122ad49b27406ee495ef0d6cac191968d64f09f.1380532113.git.michal.simek-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>]
* [PATCH 2/3] i2c: xilinx: Set tx direction in write operation [not found] ` <c122ad49b27406ee495ef0d6cac191968d64f09f.1380532113.git.michal.simek-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> @ 2013-09-30 9:08 ` Michal Simek 2013-09-30 10:22 ` Wolfram Sang 2013-09-30 9:08 ` [PATCH 3/3] i2c: xilinx: Use devm_* functions Michal Simek 2013-09-30 10:23 ` [PATCH 1/3] i2c: xilinx: Fix i2c sparse warnings Wolfram Sang 2 siblings, 1 reply; 7+ messages in thread From: Michal Simek @ 2013-09-30 9:08 UTC (permalink / raw) To: linux-kernel-u79uwXL29TY76Z2rM5mHXA, monstr-pSz03upnqPeHXe+LvDLADg Cc: Kedareswara rao Appana, Wolfram Sang, Kedareswara rao Appana, Jean Delvare, Peter Korsgaard, linux-i2c-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 1214 bytes --] From: Kedareswara rao Appana <appana.durga.rao-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> In write operation, after filling address byte to tx fifo, set the direction of transfer to tx using control register. Signed-off-by: Kedareswara rao Appana <appanad-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> Signed-off-by: Michal Simek <michal.simek-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> --- drivers/i2c/busses/i2c-xiic.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index 5eb0a8b..44e6ae7 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c @@ -536,6 +536,7 @@ static void xiic_start_recv(struct xiic_i2c *i2c) static void xiic_start_send(struct xiic_i2c *i2c) { struct i2c_msg *msg = i2c->tx_msg; + u32 cr; xiic_irq_clr(i2c, XIIC_INTR_TX_ERROR_MASK); @@ -556,6 +557,10 @@ static void xiic_start_send(struct xiic_i2c *i2c) xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET, data); } + cr = xiic_getreg32(i2c, XIIC_CR_REG_OFFSET); + cr |= XIIC_CR_DIR_IS_TX_MASK; + xiic_setreg32(i2c, XIIC_CR_REG_OFFSET, cr); + xiic_fill_tx_fifo(i2c); /* Clear any pending Tx empty, Tx Error and then enable them. */ -- 1.8.2.3 [-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] i2c: xilinx: Set tx direction in write operation 2013-09-30 9:08 ` [PATCH 2/3] i2c: xilinx: Set tx direction in write operation Michal Simek @ 2013-09-30 10:22 ` Wolfram Sang 2013-09-30 13:25 ` Michal Simek 0 siblings, 1 reply; 7+ messages in thread From: Wolfram Sang @ 2013-09-30 10:22 UTC (permalink / raw) To: Michal Simek Cc: linux-kernel, monstr, Kedareswara rao Appana, Kedareswara rao Appana, Jean Delvare, Peter Korsgaard, linux-i2c [-- Attachment #1: Type: text/plain, Size: 1467 bytes --] On Mon, Sep 30, 2013 at 11:08:51AM +0200, Michal Simek wrote: > From: Kedareswara rao Appana <appana.durga.rao@xilinx.com> > > In write operation, after filling address byte to tx fifo, > set the direction of transfer to tx using control register. You describe WHAT you do, yet you should describe WHY the change is needed. For example, I can't tell if this is an urgent bugfix or not. Please rephrase. > > Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com> > Signed-off-by: Michal Simek <michal.simek@xilinx.com> > --- > drivers/i2c/busses/i2c-xiic.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c > index 5eb0a8b..44e6ae7 100644 > --- a/drivers/i2c/busses/i2c-xiic.c > +++ b/drivers/i2c/busses/i2c-xiic.c > @@ -536,6 +536,7 @@ static void xiic_start_recv(struct xiic_i2c *i2c) > static void xiic_start_send(struct xiic_i2c *i2c) > { > struct i2c_msg *msg = i2c->tx_msg; > + u32 cr; > > xiic_irq_clr(i2c, XIIC_INTR_TX_ERROR_MASK); > > @@ -556,6 +557,10 @@ static void xiic_start_send(struct xiic_i2c *i2c) > xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET, data); > } > > + cr = xiic_getreg32(i2c, XIIC_CR_REG_OFFSET); > + cr |= XIIC_CR_DIR_IS_TX_MASK; > + xiic_setreg32(i2c, XIIC_CR_REG_OFFSET, cr); > + > xiic_fill_tx_fifo(i2c); > > /* Clear any pending Tx empty, Tx Error and then enable them. */ > -- > 1.8.2.3 > [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] i2c: xilinx: Set tx direction in write operation 2013-09-30 10:22 ` Wolfram Sang @ 2013-09-30 13:25 ` Michal Simek 0 siblings, 0 replies; 7+ messages in thread From: Michal Simek @ 2013-09-30 13:25 UTC (permalink / raw) To: Wolfram Sang Cc: Michal Simek, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Kedareswara rao Appana, Kedareswara rao Appana, Jean Delvare, Peter Korsgaard, linux-i2c-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 848 bytes --] On 09/30/2013 12:22 PM, Wolfram Sang wrote: > On Mon, Sep 30, 2013 at 11:08:51AM +0200, Michal Simek wrote: >> From: Kedareswara rao Appana <appana.durga.rao-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> >> >> In write operation, after filling address byte to tx fifo, >> set the direction of transfer to tx using control register. > > You describe WHAT you do, yet you should describe WHY the change is > needed. For example, I can't tell if this is an urgent bugfix or not. > Please rephrase. > Will do. Thanks, Michal -- Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 263 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/3] i2c: xilinx: Use devm_* functions [not found] ` <c122ad49b27406ee495ef0d6cac191968d64f09f.1380532113.git.michal.simek-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> 2013-09-30 9:08 ` [PATCH 2/3] i2c: xilinx: Set tx direction in write operation Michal Simek @ 2013-09-30 9:08 ` Michal Simek 2013-09-30 10:23 ` [PATCH 1/3] i2c: xilinx: Fix i2c sparse warnings Wolfram Sang 2 siblings, 0 replies; 7+ messages in thread From: Michal Simek @ 2013-09-30 9:08 UTC (permalink / raw) To: linux-kernel-u79uwXL29TY76Z2rM5mHXA, monstr-pSz03upnqPeHXe+LvDLADg Cc: Kedareswara rao Appana, Wolfram Sang, Kedareswara rao Appana, Jean Delvare, Peter Korsgaard, linux-i2c-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 3574 bytes --] From: Kedareswara rao Appana <appana.durga.rao-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> Simplified the probe and remove functions using devm_* functions Signed-off-by: Kedareswara rao Appana <appanad-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> Signed-off-by: Michal Simek <michal.simek-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> --- drivers/i2c/busses/i2c-xiic.c | 69 +++++++++++-------------------------------- 1 file changed, 18 insertions(+), 51 deletions(-) diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index 44e6ae7..6dd3212 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c @@ -32,6 +32,7 @@ #include <linux/module.h> #include <linux/init.h> #include <linux/errno.h> +#include <linux/err.h> #include <linux/delay.h> #include <linux/platform_device.h> #include <linux/i2c.h> @@ -698,32 +699,28 @@ static int xiic_i2c_probe(struct platform_device *pdev) int ret, irq; u8 i; + i2c = devm_kzalloc(&pdev->dev, sizeof(*i2c), GFP_KERNEL); + if (!i2c) + return -ENOMEM; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - goto resource_missing; + i2c->base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(i2c->base)) { + dev_err(&pdev->dev, "Could not allocate iomem\n"); + return PTR_ERR(i2c->base); + } irq = platform_get_irq(pdev, 0); if (irq < 0) - goto resource_missing; - - pdata = (struct xiic_i2c_platform_data *)dev_get_platdata(&pdev->dev); + return irq; - i2c = kzalloc(sizeof(*i2c), GFP_KERNEL); - if (!i2c) - return -ENOMEM; - - if (!request_mem_region(res->start, resource_size(res), pdev->name)) { - dev_err(&pdev->dev, "Memory region busy\n"); - ret = -EBUSY; - goto request_mem_failed; + ret = devm_request_irq(&pdev->dev, irq, xiic_isr, 0, pdev->name, i2c); + if (ret < 0) { + dev_err(&pdev->dev, "Cannot claim IRQ\n"); + return ret; } - i2c->base = ioremap(res->start, resource_size(res)); - if (!i2c->base) { - dev_err(&pdev->dev, "Unable to map registers\n"); - ret = -EIO; - goto map_failed; - } + pdata = (struct xiic_i2c_platform_data *)dev_get_platdata(&pdev->dev); /* hook up driver to tree */ platform_set_drvdata(pdev, i2c); @@ -736,17 +733,13 @@ static int xiic_i2c_probe(struct platform_device *pdev) spin_lock_init(&i2c->lock); init_waitqueue_head(&i2c->wait); - ret = request_irq(irq, xiic_isr, 0, pdev->name, i2c); - if (ret) { - dev_err(&pdev->dev, "Cannot claim IRQ\n"); - goto request_irq_failed; - } /* add i2c adapter to i2c tree */ ret = i2c_add_adapter(&i2c->adap); if (ret) { dev_err(&pdev->dev, "Failed to add adapter\n"); - goto add_adapter_failed; + xiic_deinit(i2c); + return ret; } if (pdata) { @@ -756,43 +749,17 @@ static int xiic_i2c_probe(struct platform_device *pdev) } return 0; - -add_adapter_failed: - free_irq(irq, i2c); -request_irq_failed: - xiic_deinit(i2c); - iounmap(i2c->base); -map_failed: - release_mem_region(res->start, resource_size(res)); -request_mem_failed: - kfree(i2c); - - return ret; -resource_missing: - dev_err(&pdev->dev, "IRQ or Memory resource is missing\n"); - return -ENOENT; } static int xiic_i2c_remove(struct platform_device *pdev) { struct xiic_i2c *i2c = platform_get_drvdata(pdev); - struct resource *res; /* remove adapter & data */ i2c_del_adapter(&i2c->adap); xiic_deinit(i2c); - free_irq(platform_get_irq(pdev, 0), i2c); - - iounmap(i2c->base); - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res) - release_mem_region(res->start, resource_size(res)); - - kfree(i2c); - return 0; } -- 1.8.2.3 [-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] i2c: xilinx: Fix i2c sparse warnings [not found] ` <c122ad49b27406ee495ef0d6cac191968d64f09f.1380532113.git.michal.simek-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> 2013-09-30 9:08 ` [PATCH 2/3] i2c: xilinx: Set tx direction in write operation Michal Simek 2013-09-30 9:08 ` [PATCH 3/3] i2c: xilinx: Use devm_* functions Michal Simek @ 2013-09-30 10:23 ` Wolfram Sang 2013-09-30 13:24 ` Michal Simek 2 siblings, 1 reply; 7+ messages in thread From: Wolfram Sang @ 2013-09-30 10:23 UTC (permalink / raw) To: Michal Simek Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, monstr-pSz03upnqPeHXe+LvDLADg, Kedareswara rao Appana, Kedareswara rao Appana, Jean Delvare, Peter Korsgaard, linux-i2c-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 463 bytes --] On Mon, Sep 30, 2013 at 11:08:50AM +0200, Michal Simek wrote: > From: Kedareswara rao Appana <appana.durga.rao-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> > > code changes to fix sparse warnings Would be nice to either have them listed here or at least shortly described. > > Signed-off-by: Kedareswara rao Appana <appanad-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> > Signed-off-by: Michal Simek <michal.simek-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] i2c: xilinx: Fix i2c sparse warnings 2013-09-30 10:23 ` [PATCH 1/3] i2c: xilinx: Fix i2c sparse warnings Wolfram Sang @ 2013-09-30 13:24 ` Michal Simek 0 siblings, 0 replies; 7+ messages in thread From: Michal Simek @ 2013-09-30 13:24 UTC (permalink / raw) To: Wolfram Sang Cc: Michal Simek, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Kedareswara rao Appana, Kedareswara rao Appana, Jean Delvare, Peter Korsgaard, linux-i2c-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 776 bytes --] On 09/30/2013 12:23 PM, Wolfram Sang wrote: > On Mon, Sep 30, 2013 at 11:08:50AM +0200, Michal Simek wrote: >> From: Kedareswara rao Appana <appana.durga.rao-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> >> >> code changes to fix sparse warnings > > Would be nice to either have them listed here or at least shortly > described. I will send v2. I see that Kedar wrote sparse warning but they are checkpatch warnings. I will fix that. Thanks, Michal -- Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 263 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-09-30 13:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-30 9:08 [PATCH 1/3] i2c: xilinx: Fix i2c sparse warnings Michal Simek
[not found] ` <c122ad49b27406ee495ef0d6cac191968d64f09f.1380532113.git.michal.simek-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2013-09-30 9:08 ` [PATCH 2/3] i2c: xilinx: Set tx direction in write operation Michal Simek
2013-09-30 10:22 ` Wolfram Sang
2013-09-30 13:25 ` Michal Simek
2013-09-30 9:08 ` [PATCH 3/3] i2c: xilinx: Use devm_* functions Michal Simek
2013-09-30 10:23 ` [PATCH 1/3] i2c: xilinx: Fix i2c sparse warnings Wolfram Sang
2013-09-30 13:24 ` Michal Simek
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).