* Re: [PATCH 2/2] lpc_eth: Use resource_size instead of computation
2014-05-28 15:14 ` [PATCH 2/2] lpc_eth: " Benoit Taine
@ 2014-05-28 16:16 ` Joe Perches
2014-06-02 2:27 ` David Miller
` (2 subsequent siblings)
3 siblings, 0 replies; 14+ messages in thread
From: Joe Perches @ 2014-05-28 16:16 UTC (permalink / raw)
To: Benoit Taine; +Cc: netdev, linux-kernel, kernel-janitors
On Wed, 2014-05-28 at 17:14 +0200, Benoit Taine wrote:
> This issue was reported by coccicheck using the semantic patch
> at scripts/coccinelle/api/resource_size.cocci
Slightly associated trivial note:
> diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
[]
> @@ -1419,8 +1419,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
>
> netdev_dbg(ndev, "IO address start :0x%08x\n",
> res->start);
> - netdev_dbg(ndev, "IO address size :%d\n",
> - res->end - res->start + 1);
> + netdev_dbg(ndev, "IO address size :%d\n", resource_size(res));
May be better using:
netdev_dbg(ndev, "IO :%pR\n", res)
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH 2/2] lpc_eth: Use resource_size instead of computation
2014-05-28 15:14 ` [PATCH 2/2] lpc_eth: " Benoit Taine
2014-05-28 16:16 ` Joe Perches
@ 2014-06-02 2:27 ` David Miller
2014-06-02 11:24 ` [PATCH 2/2 v2] " Benoit Taine
2014-06-02 7:45 ` [PATCH 2/2] " walter harms
2014-06-02 11:28 ` Benoit Taine
3 siblings, 1 reply; 14+ messages in thread
From: David Miller @ 2014-06-02 2:27 UTC (permalink / raw)
To: benoit.taine; +Cc: netdev, linux-kernel, kernel-janitors
From: Benoit Taine <benoit.taine@lip6.fr>
Date: Wed, 28 May 2014 17:14:07 +0200
> @@ -1419,8 +1419,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
>
> netdev_dbg(ndev, "IO address start :0x%08x\n",
> res->start);
> - netdev_dbg(ndev, "IO address size :%d\n",
> - res->end - res->start + 1);
> + netdev_dbg(ndev, "IO address size :%d\n", resource_size(res));
> netdev_dbg(ndev, "IO address (mapped) :0x%p\n",
> pldat->net_base);
Please replace all of this with %pR as suggested by Joe, thanks.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/2 v2] lpc_eth: Use resource_size instead of computation
2014-06-02 2:27 ` David Miller
@ 2014-06-02 11:24 ` Benoit Taine
2014-06-02 11:34 ` [PATCH 2/2 v3] " Benoit Taine
0 siblings, 1 reply; 14+ messages in thread
From: Benoit Taine @ 2014-06-02 11:24 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-kernel, kernel-janitors
This issue was reported by coccicheck using the semantic patch
at scripts/coccinelle/api/resource_size.cocci
Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>
---
Not compile tested, due incompatible architecture.
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 422d9b5..645dac3 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1361,7 +1361,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
__lpc_eth_clock_enable(pldat, true);
/* Map IO space */
- pldat->net_base = ioremap(res->start, res->end - res->start + 1);
+ pldat->net_base = ioremap(res->start, resource_size(res));
if (!pldat->net_base) {
dev_err(&pdev->dev, "failed to map registers\n");
ret = -ENOMEM;
@@ -1417,10 +1417,8 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
}
pldat->dma_buff_base_p = dma_handle;
- netdev_dbg(ndev, "IO address start :0x%08x\n",
- res->start);
- netdev_dbg(ndev, "IO address size :%d\n",
- res->end - res->start + 1);
+ netdev_dbg(ndev, "IO address space :%pR", res);
+ netdev_dbg(ndev, "IO address size :%d\n", resource_size(res));
netdev_dbg(ndev, "IO address (mapped) :0x%p\n",
pldat->net_base);
netdev_dbg(ndev, "IRQ number :%d\n", ndev->irq);
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH 2/2 v3] lpc_eth: Use resource_size instead of computation
2014-06-02 11:24 ` [PATCH 2/2 v2] " Benoit Taine
@ 2014-06-02 11:34 ` Benoit Taine
2014-06-02 17:58 ` David Miller
2014-06-03 10:32 ` [PATCH 2/2 v4] " Benoit Taine
0 siblings, 2 replies; 14+ messages in thread
From: Benoit Taine @ 2014-06-02 11:34 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-kernel, kernel-janitors
This issue was reported by coccicheck using the semantic patch
at scripts/coccinelle/api/resource_size.cocci
Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>
---
Not compile tested, due incompatible architecture.
Changes from V2:
- added line break to debug message
Changes from V1:
- Use %pR format type with the debug message (Thanks to Joe Perches)
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 422d9b5..645dac3 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1361,7 +1361,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
__lpc_eth_clock_enable(pldat, true);
/* Map IO space */
- pldat->net_base = ioremap(res->start, res->end - res->start + 1);
+ pldat->net_base = ioremap(res->start, resource_size(res));
if (!pldat->net_base) {
dev_err(&pdev->dev, "failed to map registers\n");
ret = -ENOMEM;
@@ -1417,10 +1417,8 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
}
pldat->dma_buff_base_p = dma_handle;
- netdev_dbg(ndev, "IO address start :0x%08x\n",
- res->start);
- netdev_dbg(ndev, "IO address size :%d\n",
- res->end - res->start + 1);
+ netdev_dbg(ndev, "IO address space :%pR\n", res);
+ netdev_dbg(ndev, "IO address size :%d\n", resource_size(res));
netdev_dbg(ndev, "IO address (mapped) :0x%p\n",
pldat->net_base);
netdev_dbg(ndev, "IRQ number :%d\n", ndev->irq);
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH 2/2 v3] lpc_eth: Use resource_size instead of computation
2014-06-02 11:34 ` [PATCH 2/2 v3] " Benoit Taine
@ 2014-06-02 17:58 ` David Miller
2014-06-03 10:32 ` [PATCH 2/2 v4] " Benoit Taine
1 sibling, 0 replies; 14+ messages in thread
From: David Miller @ 2014-06-02 17:58 UTC (permalink / raw)
To: benoit.taine; +Cc: netdev, linux-kernel, kernel-janitors
From: Benoit Taine <benoit.taine@lip6.fr>
Date: Mon, 2 Jun 2014 13:34:30 +0200
> This issue was reported by coccicheck using the semantic patch
> at scripts/coccinelle/api/resource_size.cocci
>
> Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>
This patch doesn't apply cleanly to any of my trees.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/2 v4] lpc_eth: Use resource_size instead of computation
2014-06-02 11:34 ` [PATCH 2/2 v3] " Benoit Taine
2014-06-02 17:58 ` David Miller
@ 2014-06-03 10:32 ` Benoit Taine
2014-06-03 10:45 ` [PATCH 2/2 v5] " Benoit Taine
1 sibling, 1 reply; 14+ messages in thread
From: Benoit Taine @ 2014-06-03 10:32 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-kernel, kernel-janitors
This issue was reported by coccicheck using the semantic patch
at scripts/coccinelle/api/resource_size.cocci
Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>
---
Not compile tested, due incompatible architecture.
Changes from V3:
- should now apply correctly
Changes from V2:
- added line break to debug message
Changes from V1:
- Use %pR format type with the debug message (Thanks to Joe Perches)
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 422d9b5..8706c0d 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1361,7 +1361,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
__lpc_eth_clock_enable(pldat, true);
/* Map IO space */
- pldat->net_base = ioremap(res->start, res->end - res->start + 1);
+ pldat->net_base = ioremap(res->start, resource_size(res));
if (!pldat->net_base) {
dev_err(&pdev->dev, "failed to map registers\n");
ret = -ENOMEM;
@@ -1417,10 +1417,8 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
}
pldat->dma_buff_base_p = dma_handle;
- netdev_dbg(ndev, "IO address start :0x%08x\n",
- res->start);
- netdev_dbg(ndev, "IO address size :%d\n",
- res->end - res->start + 1);
+ netdev_dbg(ndev, "IO address space :%pR\n", res);
+ netdev_dbg(ndev, "IO address size :%d\n", resource_size(res));
netdev_dbg(ndev, "IO address (mapped) :0x%p\n",
pldat->net_base);
netdev_dbg(ndev, "IRQ number :%d\n", ndev->irq);
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 2/2 v5] lpc_eth: Use resource_size instead of computation
2014-06-03 10:32 ` [PATCH 2/2 v4] " Benoit Taine
@ 2014-06-03 10:45 ` Benoit Taine
2014-06-03 23:09 ` David Miller
0 siblings, 1 reply; 14+ messages in thread
From: Benoit Taine @ 2014-06-03 10:45 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-kernel, kernel-janitors
This issue was reported by coccicheck using the semantic patch
at scripts/coccinelle/api/resource_size.cocci
Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>
---
Not compile tested, due incompatible architecture.
Changes from V4:
- Added blank line a the end of the diff (Thank to David Miller for your
patience)
Changes from V3:
- should now apply correctly
Changes from V2:
- added line break to debug message
Changes from V1:
- Use %pR format type with the debug message (Thanks to Joe Perches)
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 422d9b5..8706c0d 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1361,7 +1361,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
__lpc_eth_clock_enable(pldat, true);
/* Map IO space */
- pldat->net_base = ioremap(res->start, res->end - res->start + 1);
+ pldat->net_base = ioremap(res->start, resource_size(res));
if (!pldat->net_base) {
dev_err(&pdev->dev, "failed to map registers\n");
ret = -ENOMEM;
@@ -1417,10 +1417,8 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
}
pldat->dma_buff_base_p = dma_handle;
- netdev_dbg(ndev, "IO address start :0x%08x\n",
- res->start);
- netdev_dbg(ndev, "IO address size :%d\n",
- res->end - res->start + 1);
+ netdev_dbg(ndev, "IO address space :%pR\n", res);
+ netdev_dbg(ndev, "IO address size :%d\n", resource_size(res));
netdev_dbg(ndev, "IO address (mapped) :0x%p\n",
pldat->net_base);
netdev_dbg(ndev, "IRQ number :%d\n", ndev->irq);
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH 2/2 v5] lpc_eth: Use resource_size instead of computation
2014-06-03 10:45 ` [PATCH 2/2 v5] " Benoit Taine
@ 2014-06-03 23:09 ` David Miller
0 siblings, 0 replies; 14+ messages in thread
From: David Miller @ 2014-06-03 23:09 UTC (permalink / raw)
To: benoit.taine; +Cc: netdev, linux-kernel, kernel-janitors
From: Benoit Taine <benoit.taine@lip6.fr>
Date: Tue, 3 Jun 2014 12:45:59 +0200
> This issue was reported by coccicheck using the semantic patch
> at scripts/coccinelle/api/resource_size.cocci
>
> Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>
Applied, thanks.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] lpc_eth: Use resource_size instead of computation
2014-05-28 15:14 ` [PATCH 2/2] lpc_eth: " Benoit Taine
2014-05-28 16:16 ` Joe Perches
2014-06-02 2:27 ` David Miller
@ 2014-06-02 7:45 ` walter harms
2014-06-02 11:28 ` Benoit Taine
3 siblings, 0 replies; 14+ messages in thread
From: walter harms @ 2014-06-02 7:45 UTC (permalink / raw)
To: kernel-janitors
Am 02.06.2014 04:27, schrieb David Miller:
> From: Benoit Taine <benoit.taine@lip6.fr>
> Date: Wed, 28 May 2014 17:14:07 +0200
>
>> @@ -1419,8 +1419,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
>>
>> netdev_dbg(ndev, "IO address start :0x%08x\n",
>> res->start);
>> - netdev_dbg(ndev, "IO address size :%d\n",
>> - res->end - res->start + 1);
>> + netdev_dbg(ndev, "IO address size :%d\n", resource_size(res));
>> netdev_dbg(ndev, "IO address (mapped) :0x%p\n",
>> pldat->net_base);
>
> Please replace all of this with %pR as suggested by Joe, thanks.
Just for my curiosity: what does %pR mean ? (%p is ok, what is R ?)
re,
wh
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] lpc_eth: Use resource_size instead of computation
2014-05-28 15:14 ` [PATCH 2/2] lpc_eth: " Benoit Taine
` (2 preceding siblings ...)
2014-06-02 7:45 ` [PATCH 2/2] " walter harms
@ 2014-06-02 11:28 ` Benoit Taine
3 siblings, 0 replies; 14+ messages in thread
From: Benoit Taine @ 2014-06-02 11:28 UTC (permalink / raw)
To: kernel-janitors
On 02/06/2014 09:45, Walter Harms wrote:
> Just for my curiosity: what does %pR mean ? (%p is ok, what is R ?)
According to Documentation/printk-formats.txt, it prints struct
resources with a decoded flags member:
[mem 0x60000000-0x6fffffff pref]
or
[mem 0x0000000060000000-0x000000006fffffff pref]
--
Benoît Taine
Master cycle intern
Regal Team. LIP6
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 14+ messages in thread