2011-04-02 08:52:11

by Dong Aisheng

[permalink] [raw]
Subject: [PATCH 1/1] uio: clean uioinfo when uninstall uio driver

From: Jie Zhou <[email protected]>

The uioinfo should be cleaned up when uninstall, otherwise re-install
failure of uio_pdrv_genirq.ko will happen.

Signed-off-by: Jie Zhou <[email protected]>
Signed-off-by: Aisheng Dong <[email protected]>
---
drivers/uio/uio_pdrv_genirq.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c
index 7174d51..e669a2c 100644
--- a/drivers/uio/uio_pdrv_genirq.c
+++ b/drivers/uio/uio_pdrv_genirq.c
@@ -189,6 +189,12 @@ static int uio_pdrv_genirq_remove(struct platform_device *pdev)

uio_unregister_device(priv->uioinfo);
pm_runtime_disable(&pdev->dev);
+
+ priv->uioinfo->irq_flags = 0;
+ priv->uioinfo->handler = NULL;
+ priv->uioinfo->irqcontrol = NULL;
+ priv->uioinfo->priv = NULL;
+
kfree(priv);
return 0;
}
--
1.7.0.4


2011-04-04 17:16:23

by Hans J. Koch

[permalink] [raw]
Subject: Re: [PATCH 1/1] uio: clean uioinfo when uninstall uio driver

On Sat, Apr 02, 2011 at 04:55:23PM +0800, Aisheng Dong wrote:
> From: Jie Zhou <[email protected]>
>
> The uioinfo should be cleaned up when uninstall, otherwise re-install
> failure of uio_pdrv_genirq.ko will happen.
>
> Signed-off-by: Jie Zhou <[email protected]>
> Signed-off-by: Aisheng Dong <[email protected]>
> ---
> drivers/uio/uio_pdrv_genirq.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c
> index 7174d51..e669a2c 100644
> --- a/drivers/uio/uio_pdrv_genirq.c
> +++ b/drivers/uio/uio_pdrv_genirq.c
> @@ -189,6 +189,12 @@ static int uio_pdrv_genirq_remove(struct platform_device *pdev)
>
> uio_unregister_device(priv->uioinfo);
> pm_runtime_disable(&pdev->dev);
> +
> + priv->uioinfo->irq_flags = 0;

Why this one?

> + priv->uioinfo->handler = NULL;
> + priv->uioinfo->irqcontrol = NULL;

Both OK, good catch!

> + priv->uioinfo->priv = NULL;

Why this one?

> +
> kfree(priv);
> return 0;
> }

Thanks,
Hans

2011-04-06 06:11:36

by Dong Aisheng

[permalink] [raw]
Subject: RE: [PATCH 1/1] uio: clean uioinfo when uninstall uio driver

> -----Original Message-----
> From: Hans J. Koch [mailto:[email protected]]
> Sent: Tuesday, April 05, 2011 1:16 AM
> To: Dong Aisheng-B29396
> Cc: [email protected]; [email protected]; [email protected]
> Subject: Re: [PATCH 1/1] uio: clean uioinfo when uninstall uio driver
>
> On Sat, Apr 02, 2011 at 04:55:23PM +0800, Aisheng Dong wrote:
> > From: Jie Zhou <[email protected]>
> >
> > The uioinfo should be cleaned up when uninstall, otherwise re-install
> > failure of uio_pdrv_genirq.ko will happen.
> >
> > Signed-off-by: Jie Zhou <[email protected]>
> > Signed-off-by: Aisheng Dong <[email protected]>
> > ---
> > drivers/uio/uio_pdrv_genirq.c | 6 ++++++
> > 1 files changed, 6 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/uio/uio_pdrv_genirq.c
> > b/drivers/uio/uio_pdrv_genirq.c index 7174d51..e669a2c 100644
> > --- a/drivers/uio/uio_pdrv_genirq.c
> > +++ b/drivers/uio/uio_pdrv_genirq.c
> > @@ -189,6 +189,12 @@ static int uio_pdrv_genirq_remove(struct
> > platform_device *pdev)
> >
> > uio_unregister_device(priv->uioinfo);
> > pm_runtime_disable(&pdev->dev);
> > +
> > + priv->uioinfo->irq_flags = 0;
>
> Why this one?
Could be removed.

> > + priv->uioinfo->handler = NULL;
> > + priv->uioinfo->irqcontrol = NULL;
>
> Both OK, good catch!
>
> > + priv->uioinfo->priv = NULL;
>
> Why this one?
Could be removed.

Thanks for the info.
The V2 patch will be soon.