On Wed, Feb 23, 2011 at 12:19:58PM -0800, Haiyang Zhang wrote:
> The patch fixed the code depending on the exact order of fields in the
> struct storvsc_driver_context. Now, we use container_of() instead of type
> casting from the first field to the container struct.
> 
> Signed-off-by: Haiyang Zhang <haiya...@microsoft.com>
> Signed-off-by: K. Y. Srinivasan <k...@microsoft.com>
> Signed-off-by: Hank Janssen <hjans...@microsoft.com>
> 
> ---
>  drivers/staging/hv/storvsc_drv.c |   14 ++++++--------
>  1 files changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/hv/storvsc_drv.c 
> b/drivers/staging/hv/storvsc_drv.c
> index 33acee5..a364627 100644
> --- a/drivers/staging/hv/storvsc_drv.c
> +++ b/drivers/staging/hv/storvsc_drv.c
> @@ -64,8 +64,6 @@ struct storvsc_cmd_request {
>  };
>  
>  struct storvsc_driver_context {
> -     /* !! These must be the first 2 fields !! */
> -     /* FIXME this is a bug... */
>       struct driver_context drv_ctx;
>       struct storvsc_driver_object drv_obj;
>  };
> @@ -223,8 +221,8 @@ static int storvsc_probe(struct device *device)
>       int ret;
>       struct driver_context *driver_ctx =
>                               driver_to_driver_context(device->driver);
> -     struct storvsc_driver_context *storvsc_drv_ctx =
> -                             (struct storvsc_driver_context *)driver_ctx;
> +     struct storvsc_driver_context *storvsc_drv_ctx = container_of(
> +             driver_ctx, struct storvsc_driver_context, drv_ctx);

Same container_of() macro/inline function issue.

thanks,

greg k-h
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/virtualization

Reply via email to