diff options
author | Roel Kluin <roel.kluin@gmail.com> | 2009-06-10 00:38:52 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-06-15 02:47:23 -0400 |
commit | 6dee2c87ebbe5d7ce8c4c163966a0bd9c02c75ef (patch) | |
tree | d3ba06ad73c80fb9fccd9c0a0b590f5cc6bec6d4 /drivers/block/ps3disk.c | |
parent | 1bd9784f5ebb5b1b5a1efb8302d7b57c6483e2e6 (diff) |
block/ps3: remove driver_data direct access of struct device
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.
[Geert: Use ps3_system_bus_[gs]et_driver_data() for ps3_system_bus_device]
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Cc: Jim Paris <jim@jtan.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/block/ps3disk.c')
-rw-r--r-- | drivers/block/ps3disk.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c index aaeeb544228a..fdd2d7a00338 100644 --- a/drivers/block/ps3disk.c +++ b/drivers/block/ps3disk.c | |||
@@ -120,7 +120,8 @@ static void ps3disk_scatter_gather(struct ps3_storage_device *dev, | |||
120 | static int ps3disk_submit_request_sg(struct ps3_storage_device *dev, | 120 | static int ps3disk_submit_request_sg(struct ps3_storage_device *dev, |
121 | struct request *req) | 121 | struct request *req) |
122 | { | 122 | { |
123 | struct ps3disk_private *priv = dev->sbd.core.driver_data; | 123 | struct ps3disk_private *priv = |
124 | ps3_system_bus_get_driver_data(&dev->sbd); | ||
124 | int write = rq_data_dir(req), res; | 125 | int write = rq_data_dir(req), res; |
125 | const char *op = write ? "write" : "read"; | 126 | const char *op = write ? "write" : "read"; |
126 | u64 start_sector, sectors; | 127 | u64 start_sector, sectors; |
@@ -168,7 +169,8 @@ static int ps3disk_submit_request_sg(struct ps3_storage_device *dev, | |||
168 | static int ps3disk_submit_flush_request(struct ps3_storage_device *dev, | 169 | static int ps3disk_submit_flush_request(struct ps3_storage_device *dev, |
169 | struct request *req) | 170 | struct request *req) |
170 | { | 171 | { |
171 | struct ps3disk_private *priv = dev->sbd.core.driver_data; | 172 | struct ps3disk_private *priv = |
173 | ps3_system_bus_get_driver_data(&dev->sbd); | ||
172 | u64 res; | 174 | u64 res; |
173 | 175 | ||
174 | dev_dbg(&dev->sbd.core, "%s:%u: flush request\n", __func__, __LINE__); | 176 | dev_dbg(&dev->sbd.core, "%s:%u: flush request\n", __func__, __LINE__); |
@@ -213,7 +215,8 @@ static void ps3disk_do_request(struct ps3_storage_device *dev, | |||
213 | static void ps3disk_request(struct request_queue *q) | 215 | static void ps3disk_request(struct request_queue *q) |
214 | { | 216 | { |
215 | struct ps3_storage_device *dev = q->queuedata; | 217 | struct ps3_storage_device *dev = q->queuedata; |
216 | struct ps3disk_private *priv = dev->sbd.core.driver_data; | 218 | struct ps3disk_private *priv = |
219 | ps3_system_bus_get_driver_data(&dev->sbd); | ||
217 | 220 | ||
218 | if (priv->req) { | 221 | if (priv->req) { |
219 | dev_dbg(&dev->sbd.core, "%s:%u busy\n", __func__, __LINE__); | 222 | dev_dbg(&dev->sbd.core, "%s:%u busy\n", __func__, __LINE__); |
@@ -245,7 +248,7 @@ static irqreturn_t ps3disk_interrupt(int irq, void *data) | |||
245 | return IRQ_HANDLED; | 248 | return IRQ_HANDLED; |
246 | } | 249 | } |
247 | 250 | ||
248 | priv = dev->sbd.core.driver_data; | 251 | priv = ps3_system_bus_get_driver_data(&dev->sbd); |
249 | req = priv->req; | 252 | req = priv->req; |
250 | if (!req) { | 253 | if (!req) { |
251 | dev_dbg(&dev->sbd.core, | 254 | dev_dbg(&dev->sbd.core, |
@@ -364,7 +367,8 @@ static void ata_id_c_string(const u16 *id, unsigned char *s, unsigned int ofs, | |||
364 | 367 | ||
365 | static int ps3disk_identify(struct ps3_storage_device *dev) | 368 | static int ps3disk_identify(struct ps3_storage_device *dev) |
366 | { | 369 | { |
367 | struct ps3disk_private *priv = dev->sbd.core.driver_data; | 370 | struct ps3disk_private *priv = |
371 | ps3_system_bus_get_driver_data(&dev->sbd); | ||
368 | struct lv1_ata_cmnd_block ata_cmnd; | 372 | struct lv1_ata_cmnd_block ata_cmnd; |
369 | u16 *id = dev->bounce_buf; | 373 | u16 *id = dev->bounce_buf; |
370 | u64 res; | 374 | u64 res; |
@@ -445,7 +449,7 @@ static int __devinit ps3disk_probe(struct ps3_system_bus_device *_dev) | |||
445 | goto fail; | 449 | goto fail; |
446 | } | 450 | } |
447 | 451 | ||
448 | dev->sbd.core.driver_data = priv; | 452 | ps3_system_bus_set_driver_data(_dev, priv); |
449 | spin_lock_init(&priv->lock); | 453 | spin_lock_init(&priv->lock); |
450 | 454 | ||
451 | dev->bounce_size = BOUNCE_SIZE; | 455 | dev->bounce_size = BOUNCE_SIZE; |
@@ -523,7 +527,7 @@ fail_free_bounce: | |||
523 | kfree(dev->bounce_buf); | 527 | kfree(dev->bounce_buf); |
524 | fail_free_priv: | 528 | fail_free_priv: |
525 | kfree(priv); | 529 | kfree(priv); |
526 | dev->sbd.core.driver_data = NULL; | 530 | ps3_system_bus_set_driver_data(_dev, NULL); |
527 | fail: | 531 | fail: |
528 | mutex_lock(&ps3disk_mask_mutex); | 532 | mutex_lock(&ps3disk_mask_mutex); |
529 | __clear_bit(devidx, &ps3disk_mask); | 533 | __clear_bit(devidx, &ps3disk_mask); |
@@ -534,7 +538,8 @@ fail: | |||
534 | static int ps3disk_remove(struct ps3_system_bus_device *_dev) | 538 | static int ps3disk_remove(struct ps3_system_bus_device *_dev) |
535 | { | 539 | { |
536 | struct ps3_storage_device *dev = to_ps3_storage_device(&_dev->core); | 540 | struct ps3_storage_device *dev = to_ps3_storage_device(&_dev->core); |
537 | struct ps3disk_private *priv = dev->sbd.core.driver_data; | 541 | struct ps3disk_private *priv = |
542 | ps3_system_bus_get_driver_data(&dev->sbd); | ||
538 | 543 | ||
539 | mutex_lock(&ps3disk_mask_mutex); | 544 | mutex_lock(&ps3disk_mask_mutex); |
540 | __clear_bit(MINOR(disk_devt(priv->gendisk)) / PS3DISK_MINORS, | 545 | __clear_bit(MINOR(disk_devt(priv->gendisk)) / PS3DISK_MINORS, |
@@ -548,7 +553,7 @@ static int ps3disk_remove(struct ps3_system_bus_device *_dev) | |||
548 | ps3stor_teardown(dev); | 553 | ps3stor_teardown(dev); |
549 | kfree(dev->bounce_buf); | 554 | kfree(dev->bounce_buf); |
550 | kfree(priv); | 555 | kfree(priv); |
551 | dev->sbd.core.driver_data = NULL; | 556 | ps3_system_bus_set_driver_data(_dev, NULL); |
552 | return 0; | 557 | return 0; |
553 | } | 558 | } |
554 | 559 | ||