* [PATCH 2/3] drivers/parport/parport_pc.c: Convert release_resource to release_region/release_mem_reg
@ 2011-03-22 17:15 ` Julia Lawall
0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2011-03-22 17:15 UTC (permalink / raw)
To: Jiri Kosina; +Cc: kernel-janitors, Niels de Vos, linux-kernel
Request_region should be used with release_region, not
release_resource.
base_res is also dropped because it is no longer needed.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression x,E;
@@
*x = request_region(...)
... when != release_region(x)
when != x = E
* release_resource(x);
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
In the original code, the second argument of request_region is 32 and the
second argument of the following release_region is 0x8. I have thus used
0x8 as the second argument of the call to release_region introduced to
replace the call to release_resource. But shouldn't the second arguments
of all of the functions be the same?
drivers/parport/parport_pc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 8d62fb7..320a4df 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -2550,7 +2550,6 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq,
const struct parport_pc_via_data *via)
{
short inta_addr[6] = { 0x2A0, 0x2C0, 0x220, 0x240, 0x1E0 };
- struct resource *base_res;
u32 ite8872set;
u32 ite8872_lpt, ite8872_lpthi;
u8 ite8872_irq, type;
@@ -2561,8 +2560,7 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq,
/* make sure which one chip */
for (i = 0; i < 5; i++) {
- base_res = request_region(inta_addr[i], 32, "it887x");
- if (base_res) {
+ if (request_region(inta_addr[i], 32, "it887x")) {
int test;
pci_write_config_dword(pdev, 0x60,
0xe5000000 | inta_addr[i]);
@@ -2635,7 +2633,7 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq,
/*
* Release the resource so that parport_pc_probe_port can get it.
*/
- release_resource(base_res);
+ release_region(inta_addr[i], 0x8);
if (parport_pc_probe_port(ite8872_lpt, ite8872_lpthi,
irq, PARPORT_DMA_NONE, &pdev->dev, 0)) {
printk(KERN_INFO
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/3] drivers/parport/parport_pc.c: Convert release_resource to release_region/release_mem_region
@ 2011-03-22 17:15 ` Julia Lawall
0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2011-03-22 17:15 UTC (permalink / raw)
To: Jiri Kosina; +Cc: kernel-janitors, Niels de Vos, linux-kernel
Request_region should be used with release_region, not
release_resource.
base_res is also dropped because it is no longer needed.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression x,E;
@@
*x = request_region(...)
... when != release_region(x)
when != x = E
* release_resource(x);
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
In the original code, the second argument of request_region is 32 and the
second argument of the following release_region is 0x8. I have thus used
0x8 as the second argument of the call to release_region introduced to
replace the call to release_resource. But shouldn't the second arguments
of all of the functions be the same?
drivers/parport/parport_pc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 8d62fb7..320a4df 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -2550,7 +2550,6 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq,
const struct parport_pc_via_data *via)
{
short inta_addr[6] = { 0x2A0, 0x2C0, 0x220, 0x240, 0x1E0 };
- struct resource *base_res;
u32 ite8872set;
u32 ite8872_lpt, ite8872_lpthi;
u8 ite8872_irq, type;
@@ -2561,8 +2560,7 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq,
/* make sure which one chip */
for (i = 0; i < 5; i++) {
- base_res = request_region(inta_addr[i], 32, "it887x");
- if (base_res) {
+ if (request_region(inta_addr[i], 32, "it887x")) {
int test;
pci_write_config_dword(pdev, 0x60,
0xe5000000 | inta_addr[i]);
@@ -2635,7 +2633,7 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq,
/*
* Release the resource so that parport_pc_probe_port can get it.
*/
- release_resource(base_res);
+ release_region(inta_addr[i], 0x8);
if (parport_pc_probe_port(ite8872_lpt, ite8872_lpthi,
irq, PARPORT_DMA_NONE, &pdev->dev, 0)) {
printk(KERN_INFO
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 2/3] drivers/parport/parport_pc.c: Convert release_resource
2011-03-22 17:15 ` [PATCH 2/3] drivers/parport/parport_pc.c: Convert release_resource to release_region/release_mem_region Julia Lawall
@ 2011-04-11 7:19 ` Niels de Vos
-1 siblings, 0 replies; 4+ messages in thread
From: Niels de Vos @ 2011-04-11 7:19 UTC (permalink / raw)
To: Julia Lawall; +Cc: Jiri Kosina, kernel-janitors, linux-kernel
On 03/22/2011 05:15 PM, Julia Lawall wrote:
> Request_region should be used with release_region, not
> release_resource.
>
> base_res is also dropped because it is no longer needed.
>
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @@
> expression x,E;
> @@
> *x = request_region(...)
> ... when != release_region(x)
> when != x = E
> * release_resource(x);
> // </smpl>
>
> Signed-off-by: Julia Lawall <julia@diku.dk>
>
> ---
> In the original code, the second argument of request_region is 32 and the
> second argument of the following release_region is 0x8. I have thus used
> 0x8 as the second argument of the call to release_region introduced to
> replace the call to release_resource. But shouldn't the second arguments
> of all of the functions be the same?
Yes, they should. The size of the requested region was changed with
commit e7c310c36e5fdf1b83a459e5db167bfbd86137db, but one occurrence of
release_region() was not changed accordingly.
> drivers/parport/parport_pc.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
> index 8d62fb7..320a4df 100644
> --- a/drivers/parport/parport_pc.c
> +++ b/drivers/parport/parport_pc.c
> @@ -2550,7 +2550,6 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq,
> const struct parport_pc_via_data *via)
> {
> short inta_addr[6] = { 0x2A0, 0x2C0, 0x220, 0x240, 0x1E0 };
> - struct resource *base_res;
> u32 ite8872set;
> u32 ite8872_lpt, ite8872_lpthi;
> u8 ite8872_irq, type;
> @@ -2561,8 +2560,7 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq,
>
> /* make sure which one chip */
> for (i = 0; i < 5; i++) {
> - base_res = request_region(inta_addr[i], 32, "it887x");
> - if (base_res) {
> + if (request_region(inta_addr[i], 32, "it887x")) {
> int test;
> pci_write_config_dword(pdev, 0x60,
> 0xe5000000 | inta_addr[i]);
> @@ -2635,7 +2633,7 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq,
> /*
> * Release the resource so that parport_pc_probe_port can get it.
> */
> - release_resource(base_res);
> + release_region(inta_addr[i], 0x8);
0x8 is not the correct size, this should be 32. As there is an other
occurance already, I'll post an updated patch in a bit.
> if (parport_pc_probe_port(ite8872_lpt, ite8872_lpthi,
> irq, PARPORT_DMA_NONE, &pdev->dev, 0)) {
> printk(KERN_INFO
>
--
Niels de Vos, RHCE
Senior Technical Support Engineer
Global Support Services
Red Hat UK, Ltd.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 2/3] drivers/parport/parport_pc.c: Convert release_resource to release_region/release_mem_region
@ 2011-04-11 7:19 ` Niels de Vos
0 siblings, 0 replies; 4+ messages in thread
From: Niels de Vos @ 2011-04-11 7:19 UTC (permalink / raw)
To: Julia Lawall; +Cc: Jiri Kosina, kernel-janitors, linux-kernel
On 03/22/2011 05:15 PM, Julia Lawall wrote:
> Request_region should be used with release_region, not
> release_resource.
>
> base_res is also dropped because it is no longer needed.
>
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @@
> expression x,E;
> @@
> *x = request_region(...)
> ... when != release_region(x)
> when != x = E
> * release_resource(x);
> // </smpl>
>
> Signed-off-by: Julia Lawall <julia@diku.dk>
>
> ---
> In the original code, the second argument of request_region is 32 and the
> second argument of the following release_region is 0x8. I have thus used
> 0x8 as the second argument of the call to release_region introduced to
> replace the call to release_resource. But shouldn't the second arguments
> of all of the functions be the same?
Yes, they should. The size of the requested region was changed with
commit e7c310c36e5fdf1b83a459e5db167bfbd86137db, but one occurrence of
release_region() was not changed accordingly.
> drivers/parport/parport_pc.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
> index 8d62fb7..320a4df 100644
> --- a/drivers/parport/parport_pc.c
> +++ b/drivers/parport/parport_pc.c
> @@ -2550,7 +2550,6 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq,
> const struct parport_pc_via_data *via)
> {
> short inta_addr[6] = { 0x2A0, 0x2C0, 0x220, 0x240, 0x1E0 };
> - struct resource *base_res;
> u32 ite8872set;
> u32 ite8872_lpt, ite8872_lpthi;
> u8 ite8872_irq, type;
> @@ -2561,8 +2560,7 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq,
>
> /* make sure which one chip */
> for (i = 0; i < 5; i++) {
> - base_res = request_region(inta_addr[i], 32, "it887x");
> - if (base_res) {
> + if (request_region(inta_addr[i], 32, "it887x")) {
> int test;
> pci_write_config_dword(pdev, 0x60,
> 0xe5000000 | inta_addr[i]);
> @@ -2635,7 +2633,7 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq,
> /*
> * Release the resource so that parport_pc_probe_port can get it.
> */
> - release_resource(base_res);
> + release_region(inta_addr[i], 0x8);
0x8 is not the correct size, this should be 32. As there is an other
occurance already, I'll post an updated patch in a bit.
> if (parport_pc_probe_port(ite8872_lpt, ite8872_lpthi,
> irq, PARPORT_DMA_NONE, &pdev->dev, 0)) {
> printk(KERN_INFO
>
--
Niels de Vos, RHCE
Senior Technical Support Engineer
Global Support Services
Red Hat UK, Ltd.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-04-11 7:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-22 17:15 [PATCH 2/3] drivers/parport/parport_pc.c: Convert release_resource to release_region/release_mem_reg Julia Lawall
2011-03-22 17:15 ` [PATCH 2/3] drivers/parport/parport_pc.c: Convert release_resource to release_region/release_mem_region Julia Lawall
2011-04-11 7:19 ` [PATCH 2/3] drivers/parport/parport_pc.c: Convert release_resource Niels de Vos
2011-04-11 7:19 ` [PATCH 2/3] drivers/parport/parport_pc.c: Convert release_resource to release_region/release_mem_region Niels de Vos
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.