[PATCH] Software Suspend 2 for ppc64 (2/2 - virtual drivers)

Stephen Rothwell sfr at canb.auug.org.au
Tue Jul 19 10:58:09 EST 2005


On Mon, 18 Jul 2005 15:05:32 -0500 Santiago Leon <santil at us.ibm.com> wrote:
>
> Part 2/2 of software-suspend-2 for ppc64 (virtual drivers changes)...
> 
> Comments and suggestions are always welcome...
> 
> Signed-off-by: Santiago Leon <santil at us.ibm.com>

Pleas put patches inline - it make it easier for people to comment ...

> diff -urN corig/arch/ppc64/kernel/vio.c c/arch/ppc64/kernel/vio.c
> --- corig/arch/ppc64/kernel/vio.c	2005-07-14 16:55:41.000000000 -0500
> +++ c/arch/ppc64/kernel/vio.c	2005-07-14 20:02:51.000000000 -0500
> @@ -632,9 +632,32 @@
>  	return 0;
>  }
>  
> +static int vio_device_suspend(struct device * dev, pm_message_t state)
> +{
> +	struct vio_dev * vio_dev = to_vio_dev(dev);
> +	struct vio_driver *drv = to_vio_driver(dev->driver);
> +
> +	if (drv && drv->suspend)
> +		return drv->suspend(vio_dev, state);
> +	else
        ^^^^
else not needed.

> +		return 0;
> +}
> +
> +static int vio_device_resume(struct device * dev)
> +{
> +	struct vio_dev * vio_dev = to_vio_dev(dev);
> +	struct vio_driver *drv = to_vio_driver(dev->driver);
> +
> +	if (drv && drv->resume)
> +		drv->resume(vio_dev);
                ^
Shouldn't this have "return" here?

> +	return 0;

> diff -urN corig/drivers/net/ibmveth.c c/drivers/net/ibmveth.c
> --- corig/drivers/net/ibmveth.c	2005-07-14 16:55:44.000000000 -0500
> +++ c/drivers/net/ibmveth.c	2005-07-15 08:54:04.000000000 -0500

>  static struct vio_driver ibmveth_driver = {
>  	.name        = (char *)ibmveth_driver_name,
>  	.id_table    = ibmveth_device_table,
>  	.probe       = ibmveth_probe,
> -	.remove      = ibmveth_remove
> +	.remove      = ibmveth_remove,
> +	.suspend     = ibmveth_suspend,
> +	.resume      = ibmveth_resume

You might as well terminate this witha a comma ...

> diff -urN corig/include/asm-ppc64/vio.h c/include/asm-ppc64/vio.h
> --- corig/include/asm-ppc64/vio.h	2005-07-14 16:55:59.000000000 -0500
> +++ c/include/asm-ppc64/vio.h	2005-07-14 20:00:03.000000000 -0500

> @@ -79,7 +82,7 @@
>  
>  static inline struct vio_driver *to_vio_driver(struct device_driver *drv)
>  {
> -	return container_of(drv, struct vio_driver, driver);
> +	return drv ? container_of(drv, struct vio_driver, driver) : NULL;

So who is passing a NULL to to_vio_driver?

-- 
Cheers,
Stephen Rothwell                    sfr at canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20050719/f80be854/attachment.pgp 


More information about the Linuxppc64-dev mailing list