lkml.org 
[lkml]   [2011]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/4] staging: hv: Fix the code depending on struct blkvsc_driver_context data order
On Wed, Feb 23, 2011 at 12:19:57PM -0800, Haiyang Zhang wrote:
> The patch fixed the code depending on the exact order of fields in the
> struct blkvsc_driver_context. Now, we use container_of() instead of type
> casting from the first field to the container struct.
>
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
>
> ---
> drivers/staging/hv/blkvsc_drv.c | 8 +++-----
> 1 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
> index 293ab8e..8f38895 100644
> --- a/drivers/staging/hv/blkvsc_drv.c
> +++ b/drivers/staging/hv/blkvsc_drv.c
> @@ -117,8 +117,6 @@ struct block_device_context {
>
> /* Per driver */
> struct blkvsc_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;
> };
> @@ -248,7 +246,7 @@ static int blkvsc_probe(struct device *device)
> struct driver_context *driver_ctx =
> driver_to_driver_context(device->driver);
> struct blkvsc_driver_context *blkvsc_drv_ctx =
> - (struct blkvsc_driver_context *)driver_ctx;
> + container_of(driver_ctx, struct blkvsc_driver_context, drv_ctx);

Same container_of() complaint here, make it a macro or inline function.

thanks,

greg k-h


\
 
 \ /
  Last update: 2011-02-23 22:49    [W:0.127 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site