xen block: remove driver_data direct access of struct device
Subsystems (4)
PATCH 1/1 xen block: remove driver_data direct access of struct device
From: Greg Kroah-Hartman <[email protected]>
In the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- drivers/block/xen-blkfront.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/block/xen-blkfront.c +7 -7
@@ -755,12 +755,12 @@ static int blkfront_probe(struct xenbus_/* Front end dir is a number, which is used as the id. */ info->handle =simple_strtoul (strrchr (dev->nodename,'/' )+1 ,NULL ,0 ); - dev->dev.driver_data = info; +dev_det_drvdata (&dev->dev, info); err =talk_to_backend (dev, info);if (err) {kfree (info); - dev->dev.driver_data =NULL ; +dev_det_drvdata (&dev->dev,NULL );return err; }
@@ -845,7 +845,7 @@ static int blkif_recover(struct blkfront*/ static int blkfront_resume (struct xenbus_device *dev) { -struct blkfront_info *info = dev->dev.driver_data; +struct blkfront_info *info =dev_get_drvdata (&dev->dev);int err;dev_dbg (&dev->dev,"blkfront_resume: %s\n" , dev->nodename);
@@ -924,7 +924,7 @@ static void blkfront_connect(struct blkf*/ static void blkfront_closing (struct xenbus_device *dev) { -struct blkfront_info *info = dev->dev.driver_data; +struct blkfront_info *info =dev_get_drvdata (&dev->dev);unsigned long flags;dev_dbg (&dev->dev,"blkfront_closing: %s removed\n" , dev->nodename);
@@ -959,7 +959,7 @@ static void blkfront_closing(struct xenbstatic void backend_changed (struct xenbus_device *dev,enum xenbus_state backend_state) { -struct blkfront_info *info = dev->dev.driver_data; +struct blkfront_info *info =dev_get_drvdata (&dev->dev);struct block_device *bd;dev_dbg (&dev->dev,"blkfront:backend_changed.\n" );
@@ -997,7 +997,7 @@ static void backend_changed(struct xenbustatic int blkfront_remove (struct xenbus_device *dev) { -struct blkfront_info *info = dev->dev.driver_data; +struct blkfront_info *info =dev_get_drvdata (&dev->dev);dev_dbg (&dev->dev,"blkfront_remove: %s removed\n" , dev->nodename);
@@ -1010,7 +1010,7 @@ static int blkfront_remove(struct xenbusstatic int blkfront_is_ready (struct xenbus_device *dev) { -struct blkfront_info *info = dev->dev.driver_data; +struct blkfront_info *info =dev_get_drvdata (&dev->dev);return info->is_ready; }
Quoted 11 lines · * Greg Kroah-Hartman ([email protected]) wrote:
In the near future, the driver core is going to not allow direct access to the
driver_datapointer in struct device. Instead, the functionsdev_get_drvdata()anddev_set_drvdata()should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.Cc Chris Wright <[email protected]>Cc Jeremy Fitzhardinge <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
after...
drivers/block/xen-blkfront.c static int blkfront_probe(struct xenbus_ · line 763
Quoted 2 lines
drivers/block/xen-blkfront.c +1
-1- dev->dev.driver_data =NULL ; +dev_det_drvdata (&dev->dev,NULL );
...fixing your fingers/script so it compiles ;-)
Quoted 7 lines · Chris Wright
Quoted 6 lines · * Greg Kroah-Hartman ([email protected]) wrote:
In the near future, the driver core is going to not allow direct access to the
driver_datapointer in struct device. Instead, the functionsdev_get_drvdata()anddev_set_drvdata()should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
Quoted 7 lines
Quoted 5 lines
Cc Chris Wright <[email protected]>Cc Jeremy Fitzhardinge <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Acked-by Chris Wright <[email protected]>
Thanks, will add it. Any objections for this to go through my driver-core tree to Linus for 2.6.31?
Quoted 6 lines
after...
drivers/block/xen-blkfront.c static int blkfront_probe(struct xenbus_ · line 763
Quoted 2 lines
drivers/block/xen-blkfront.c +1
-1- dev->dev.driver_data =NULL ; +dev_det_drvdata (&dev->dev,NULL );...fixing your fingers/script so it compiles ;-)
Doh!
And here I thought I had built that one, I guess I hadn't, my mistake. Thanks for catching that, I've now fixed it.
greg k-h
Quoted 14 lines · * Greg KH ([email protected]) wrote:
Quoted 13 lines · Chris Wright
Quoted 11 lines · * Greg Kroah-Hartman ([email protected]) wrote:
In the near future, the driver core is going to not allow direct access to the
driver_datapointer in struct device. Instead, the functionsdev_get_drvdata()anddev_set_drvdata()should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.Cc Chris Wright <[email protected]>Cc Jeremy Fitzhardinge <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 4 lines
Quoted 1 line
Acked-by Chris Wright <[email protected]>Thanks, will add it. Any objections for this to go through my driver-core tree to Linus for 2.6.31?
None from me.
Jeremy Fitzhardinge
Acked-byQuoted 8 lines · Chris Wright
Quoted 3 lines · * Greg KH ([email protected]) wrote:
Thanks, will add it. Any objections for this to go through my driver-core tree to Linus for 2.6.31?
None from me.
Fine by me.
J
Quoted 7 lines · Jeremy Fitzhardinge
Quoted 6 lines · Chris Wright
Quoted 3 lines · * Greg KH ([email protected]) wrote:
Thanks, will add it. Any objections for this to go through my driver-core tree to Linus for 2.6.31?
Quoted 6 lines
Quoted 2 lines
None from me.
Fine by me.
Thanks, will add this ack and push it myself.
greg k-h