aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorRoel Kluin <roel.kluin@gmail.com>2009-05-05 04:41:19 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-06-16 00:30:28 -0400
commit5888fd30ac70fa50f08979c46f9206d01ca6ad49 (patch)
tree12319e3dc293a668972da4573ef2f9ab960f10c2 /drivers/block
parentdff59b64af94dc588044d70f3708cb835055c5b6 (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. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Acked-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/ps3disk.c18
-rw-r--r--drivers/block/ps3vram.c46
2 files changed, 32 insertions, 32 deletions
diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c
index aaeeb544228a..1299db15f085 100644
--- a/drivers/block/ps3disk.c
+++ b/drivers/block/ps3disk.c
@@ -120,7 +120,7 @@ static void ps3disk_scatter_gather(struct ps3_storage_device *dev,
120static int ps3disk_submit_request_sg(struct ps3_storage_device *dev, 120static 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 = dev_get_drvdata(&dev->sbd.core);
124 int write = rq_data_dir(req), res; 124 int write = rq_data_dir(req), res;
125 const char *op = write ? "write" : "read"; 125 const char *op = write ? "write" : "read";
126 u64 start_sector, sectors; 126 u64 start_sector, sectors;
@@ -168,7 +168,7 @@ static int ps3disk_submit_request_sg(struct ps3_storage_device *dev,
168static int ps3disk_submit_flush_request(struct ps3_storage_device *dev, 168static int ps3disk_submit_flush_request(struct ps3_storage_device *dev,
169 struct request *req) 169 struct request *req)
170{ 170{
171 struct ps3disk_private *priv = dev->sbd.core.driver_data; 171 struct ps3disk_private *priv = dev_get_drvdata(&dev->sbd.core);
172 u64 res; 172 u64 res;
173 173
174 dev_dbg(&dev->sbd.core, "%s:%u: flush request\n", __func__, __LINE__); 174 dev_dbg(&dev->sbd.core, "%s:%u: flush request\n", __func__, __LINE__);
@@ -213,7 +213,7 @@ static void ps3disk_do_request(struct ps3_storage_device *dev,
213static void ps3disk_request(struct request_queue *q) 213static void ps3disk_request(struct request_queue *q)
214{ 214{
215 struct ps3_storage_device *dev = q->queuedata; 215 struct ps3_storage_device *dev = q->queuedata;
216 struct ps3disk_private *priv = dev->sbd.core.driver_data; 216 struct ps3disk_private *priv = dev_get_drvdata(&dev->sbd.core);
217 217
218 if (priv->req) { 218 if (priv->req) {
219 dev_dbg(&dev->sbd.core, "%s:%u busy\n", __func__, __LINE__); 219 dev_dbg(&dev->sbd.core, "%s:%u busy\n", __func__, __LINE__);
@@ -245,7 +245,7 @@ static irqreturn_t ps3disk_interrupt(int irq, void *data)
245 return IRQ_HANDLED; 245 return IRQ_HANDLED;
246 } 246 }
247 247
248 priv = dev->sbd.core.driver_data; 248 priv = dev_get_drvdata(&dev->sbd.core);
249 req = priv->req; 249 req = priv->req;
250 if (!req) { 250 if (!req) {
251 dev_dbg(&dev->sbd.core, 251 dev_dbg(&dev->sbd.core,
@@ -364,7 +364,7 @@ static void ata_id_c_string(const u16 *id, unsigned char *s, unsigned int ofs,
364 364
365static int ps3disk_identify(struct ps3_storage_device *dev) 365static int ps3disk_identify(struct ps3_storage_device *dev)
366{ 366{
367 struct ps3disk_private *priv = dev->sbd.core.driver_data; 367 struct ps3disk_private *priv = dev_get_drvdata(&dev->sbd.core);
368 struct lv1_ata_cmnd_block ata_cmnd; 368 struct lv1_ata_cmnd_block ata_cmnd;
369 u16 *id = dev->bounce_buf; 369 u16 *id = dev->bounce_buf;
370 u64 res; 370 u64 res;
@@ -445,7 +445,7 @@ static int __devinit ps3disk_probe(struct ps3_system_bus_device *_dev)
445 goto fail; 445 goto fail;
446 } 446 }
447 447
448 dev->sbd.core.driver_data = priv; 448 dev_set_drvdata(&dev->sbd.core, priv);
449 spin_lock_init(&priv->lock); 449 spin_lock_init(&priv->lock);
450 450
451 dev->bounce_size = BOUNCE_SIZE; 451 dev->bounce_size = BOUNCE_SIZE;
@@ -523,7 +523,7 @@ fail_free_bounce:
523 kfree(dev->bounce_buf); 523 kfree(dev->bounce_buf);
524fail_free_priv: 524fail_free_priv:
525 kfree(priv); 525 kfree(priv);
526 dev->sbd.core.driver_data = NULL; 526 dev_set_drvdata(&dev->sbd.core, NULL);
527fail: 527fail:
528 mutex_lock(&ps3disk_mask_mutex); 528 mutex_lock(&ps3disk_mask_mutex);
529 __clear_bit(devidx, &ps3disk_mask); 529 __clear_bit(devidx, &ps3disk_mask);
@@ -534,7 +534,7 @@ fail:
534static int ps3disk_remove(struct ps3_system_bus_device *_dev) 534static int ps3disk_remove(struct ps3_system_bus_device *_dev)
535{ 535{
536 struct ps3_storage_device *dev = to_ps3_storage_device(&_dev->core); 536 struct ps3_storage_device *dev = to_ps3_storage_device(&_dev->core);
537 struct ps3disk_private *priv = dev->sbd.core.driver_data; 537 struct ps3disk_private *priv = dev_get_drvdata(&dev->sbd.core);
538 538
539 mutex_lock(&ps3disk_mask_mutex); 539 mutex_lock(&ps3disk_mask_mutex);
540 __clear_bit(MINOR(disk_devt(priv->gendisk)) / PS3DISK_MINORS, 540 __clear_bit(MINOR(disk_devt(priv->gendisk)) / PS3DISK_MINORS,
@@ -548,7 +548,7 @@ static int ps3disk_remove(struct ps3_system_bus_device *_dev)
548 ps3stor_teardown(dev); 548 ps3stor_teardown(dev);
549 kfree(dev->bounce_buf); 549 kfree(dev->bounce_buf);
550 kfree(priv); 550 kfree(priv);
551 dev->sbd.core.driver_data = NULL; 551 dev_set_drvdata(&dev->sbd.core, NULL);
552 return 0; 552 return 0;
553} 553}
554 554
diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c
index 8eddef373a91..8ecf1e00cede 100644
--- a/drivers/block/ps3vram.c
+++ b/drivers/block/ps3vram.c
@@ -111,7 +111,7 @@ static u32 *ps3vram_get_notifier(u32 *reports, int notifier)
111 111
112static void ps3vram_notifier_reset(struct ps3_system_bus_device *dev) 112static void ps3vram_notifier_reset(struct ps3_system_bus_device *dev)
113{ 113{
114 struct ps3vram_priv *priv = dev->core.driver_data; 114 struct ps3vram_priv *priv = dev_get_drvdata(&dev->core);
115 u32 *notify = ps3vram_get_notifier(priv->reports, NOTIFIER); 115 u32 *notify = ps3vram_get_notifier(priv->reports, NOTIFIER);
116 int i; 116 int i;
117 117
@@ -122,7 +122,7 @@ static void ps3vram_notifier_reset(struct ps3_system_bus_device *dev)
122static int ps3vram_notifier_wait(struct ps3_system_bus_device *dev, 122static int ps3vram_notifier_wait(struct ps3_system_bus_device *dev,
123 unsigned int timeout_ms) 123 unsigned int timeout_ms)
124{ 124{
125 struct ps3vram_priv *priv = dev->core.driver_data; 125 struct ps3vram_priv *priv = dev_get_drvdata(&dev->core);
126 u32 *notify = ps3vram_get_notifier(priv->reports, NOTIFIER); 126 u32 *notify = ps3vram_get_notifier(priv->reports, NOTIFIER);
127 unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms); 127 unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms);
128 128
@@ -137,7 +137,7 @@ static int ps3vram_notifier_wait(struct ps3_system_bus_device *dev,
137 137
138static void ps3vram_init_ring(struct ps3_system_bus_device *dev) 138static void ps3vram_init_ring(struct ps3_system_bus_device *dev)
139{ 139{
140 struct ps3vram_priv *priv = dev->core.driver_data; 140 struct ps3vram_priv *priv = dev_get_drvdata(&dev->core);
141 141
142 priv->ctrl[CTRL_PUT] = FIFO_BASE + FIFO_OFFSET; 142 priv->ctrl[CTRL_PUT] = FIFO_BASE + FIFO_OFFSET;
143 priv->ctrl[CTRL_GET] = FIFO_BASE + FIFO_OFFSET; 143 priv->ctrl[CTRL_GET] = FIFO_BASE + FIFO_OFFSET;
@@ -146,7 +146,7 @@ static void ps3vram_init_ring(struct ps3_system_bus_device *dev)
146static int ps3vram_wait_ring(struct ps3_system_bus_device *dev, 146static int ps3vram_wait_ring(struct ps3_system_bus_device *dev,
147 unsigned int timeout_ms) 147 unsigned int timeout_ms)
148{ 148{
149 struct ps3vram_priv *priv = dev->core.driver_data; 149 struct ps3vram_priv *priv = dev_get_drvdata(&dev->core);
150 unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms); 150 unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms);
151 151
152 do { 152 do {
@@ -175,7 +175,7 @@ static void ps3vram_begin_ring(struct ps3vram_priv *priv, u32 chan, u32 tag,
175 175
176static void ps3vram_rewind_ring(struct ps3_system_bus_device *dev) 176static void ps3vram_rewind_ring(struct ps3_system_bus_device *dev)
177{ 177{
178 struct ps3vram_priv *priv = dev->core.driver_data; 178 struct ps3vram_priv *priv = dev_get_drvdata(&dev->core);
179 int status; 179 int status;
180 180
181 ps3vram_out_ring(priv, 0x20000000 | (FIFO_BASE + FIFO_OFFSET)); 181 ps3vram_out_ring(priv, 0x20000000 | (FIFO_BASE + FIFO_OFFSET));
@@ -196,7 +196,7 @@ static void ps3vram_rewind_ring(struct ps3_system_bus_device *dev)
196 196
197static void ps3vram_fire_ring(struct ps3_system_bus_device *dev) 197static void ps3vram_fire_ring(struct ps3_system_bus_device *dev)
198{ 198{
199 struct ps3vram_priv *priv = dev->core.driver_data; 199 struct ps3vram_priv *priv = dev_get_drvdata(&dev->core);
200 int status; 200 int status;
201 201
202 mutex_lock(&ps3_gpu_mutex); 202 mutex_lock(&ps3_gpu_mutex);
@@ -225,7 +225,7 @@ static void ps3vram_fire_ring(struct ps3_system_bus_device *dev)
225 225
226static void ps3vram_bind(struct ps3_system_bus_device *dev) 226static void ps3vram_bind(struct ps3_system_bus_device *dev)
227{ 227{
228 struct ps3vram_priv *priv = dev->core.driver_data; 228 struct ps3vram_priv *priv = dev_get_drvdata(&dev->core);
229 229
230 ps3vram_begin_ring(priv, UPLOAD_SUBCH, 0, 1); 230 ps3vram_begin_ring(priv, UPLOAD_SUBCH, 0, 1);
231 ps3vram_out_ring(priv, 0x31337303); 231 ps3vram_out_ring(priv, 0x31337303);
@@ -248,7 +248,7 @@ static int ps3vram_upload(struct ps3_system_bus_device *dev,
248 unsigned int src_offset, unsigned int dst_offset, 248 unsigned int src_offset, unsigned int dst_offset,
249 int len, int count) 249 int len, int count)
250{ 250{
251 struct ps3vram_priv *priv = dev->core.driver_data; 251 struct ps3vram_priv *priv = dev_get_drvdata(&dev->core);
252 252
253 ps3vram_begin_ring(priv, UPLOAD_SUBCH, 253 ps3vram_begin_ring(priv, UPLOAD_SUBCH,
254 NV_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN, 8); 254 NV_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN, 8);
@@ -280,7 +280,7 @@ static int ps3vram_download(struct ps3_system_bus_device *dev,
280 unsigned int src_offset, unsigned int dst_offset, 280 unsigned int src_offset, unsigned int dst_offset,
281 int len, int count) 281 int len, int count)
282{ 282{
283 struct ps3vram_priv *priv = dev->core.driver_data; 283 struct ps3vram_priv *priv = dev_get_drvdata(&dev->core);
284 284
285 ps3vram_begin_ring(priv, DOWNLOAD_SUBCH, 285 ps3vram_begin_ring(priv, DOWNLOAD_SUBCH,
286 NV_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN, 8); 286 NV_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN, 8);
@@ -310,7 +310,7 @@ static int ps3vram_download(struct ps3_system_bus_device *dev,
310 310
311static void ps3vram_cache_evict(struct ps3_system_bus_device *dev, int entry) 311static void ps3vram_cache_evict(struct ps3_system_bus_device *dev, int entry)
312{ 312{
313 struct ps3vram_priv *priv = dev->core.driver_data; 313 struct ps3vram_priv *priv = dev_get_drvdata(&dev->core);
314 struct ps3vram_cache *cache = &priv->cache; 314 struct ps3vram_cache *cache = &priv->cache;
315 315
316 if (!(cache->tags[entry].flags & CACHE_PAGE_DIRTY)) 316 if (!(cache->tags[entry].flags & CACHE_PAGE_DIRTY))
@@ -332,7 +332,7 @@ static void ps3vram_cache_evict(struct ps3_system_bus_device *dev, int entry)
332static void ps3vram_cache_load(struct ps3_system_bus_device *dev, int entry, 332static void ps3vram_cache_load(struct ps3_system_bus_device *dev, int entry,
333 unsigned int address) 333 unsigned int address)
334{ 334{
335 struct ps3vram_priv *priv = dev->core.driver_data; 335 struct ps3vram_priv *priv = dev_get_drvdata(&dev->core);
336 struct ps3vram_cache *cache = &priv->cache; 336 struct ps3vram_cache *cache = &priv->cache;
337 337
338 dev_dbg(&dev->core, "Fetching %d: 0x%08x\n", entry, address); 338 dev_dbg(&dev->core, "Fetching %d: 0x%08x\n", entry, address);
@@ -352,7 +352,7 @@ static void ps3vram_cache_load(struct ps3_system_bus_device *dev, int entry,
352 352
353static void ps3vram_cache_flush(struct ps3_system_bus_device *dev) 353static void ps3vram_cache_flush(struct ps3_system_bus_device *dev)
354{ 354{
355 struct ps3vram_priv *priv = dev->core.driver_data; 355 struct ps3vram_priv *priv = dev_get_drvdata(&dev->core);
356 struct ps3vram_cache *cache = &priv->cache; 356 struct ps3vram_cache *cache = &priv->cache;
357 int i; 357 int i;
358 358
@@ -366,7 +366,7 @@ static void ps3vram_cache_flush(struct ps3_system_bus_device *dev)
366static unsigned int ps3vram_cache_match(struct ps3_system_bus_device *dev, 366static unsigned int ps3vram_cache_match(struct ps3_system_bus_device *dev,
367 loff_t address) 367 loff_t address)
368{ 368{
369 struct ps3vram_priv *priv = dev->core.driver_data; 369 struct ps3vram_priv *priv = dev_get_drvdata(&dev->core);
370 struct ps3vram_cache *cache = &priv->cache; 370 struct ps3vram_cache *cache = &priv->cache;
371 unsigned int base; 371 unsigned int base;
372 unsigned int offset; 372 unsigned int offset;
@@ -400,7 +400,7 @@ static unsigned int ps3vram_cache_match(struct ps3_system_bus_device *dev,
400 400
401static int ps3vram_cache_init(struct ps3_system_bus_device *dev) 401static int ps3vram_cache_init(struct ps3_system_bus_device *dev)
402{ 402{
403 struct ps3vram_priv *priv = dev->core.driver_data; 403 struct ps3vram_priv *priv = dev_get_drvdata(&dev->core);
404 404
405 priv->cache.page_count = CACHE_PAGE_COUNT; 405 priv->cache.page_count = CACHE_PAGE_COUNT;
406 priv->cache.page_size = CACHE_PAGE_SIZE; 406 priv->cache.page_size = CACHE_PAGE_SIZE;
@@ -419,7 +419,7 @@ static int ps3vram_cache_init(struct ps3_system_bus_device *dev)
419 419
420static void ps3vram_cache_cleanup(struct ps3_system_bus_device *dev) 420static void ps3vram_cache_cleanup(struct ps3_system_bus_device *dev)
421{ 421{
422 struct ps3vram_priv *priv = dev->core.driver_data; 422 struct ps3vram_priv *priv = dev_get_drvdata(&dev->core);
423 423
424 ps3vram_cache_flush(dev); 424 ps3vram_cache_flush(dev);
425 kfree(priv->cache.tags); 425 kfree(priv->cache.tags);
@@ -428,7 +428,7 @@ static void ps3vram_cache_cleanup(struct ps3_system_bus_device *dev)
428static int ps3vram_read(struct ps3_system_bus_device *dev, loff_t from, 428static int ps3vram_read(struct ps3_system_bus_device *dev, loff_t from,
429 size_t len, size_t *retlen, u_char *buf) 429 size_t len, size_t *retlen, u_char *buf)
430{ 430{
431 struct ps3vram_priv *priv = dev->core.driver_data; 431 struct ps3vram_priv *priv = dev_get_drvdata(&dev->core);
432 unsigned int cached, count; 432 unsigned int cached, count;
433 433
434 dev_dbg(&dev->core, "%s: from=0x%08x len=0x%zx\n", __func__, 434 dev_dbg(&dev->core, "%s: from=0x%08x len=0x%zx\n", __func__,
@@ -476,7 +476,7 @@ static int ps3vram_read(struct ps3_system_bus_device *dev, loff_t from,
476static int ps3vram_write(struct ps3_system_bus_device *dev, loff_t to, 476static int ps3vram_write(struct ps3_system_bus_device *dev, loff_t to,
477 size_t len, size_t *retlen, const u_char *buf) 477 size_t len, size_t *retlen, const u_char *buf)
478{ 478{
479 struct ps3vram_priv *priv = dev->core.driver_data; 479 struct ps3vram_priv *priv = dev_get_drvdata(&dev->core);
480 unsigned int cached, count; 480 unsigned int cached, count;
481 481
482 if (to >= priv->size) 482 if (to >= priv->size)
@@ -543,7 +543,7 @@ static const struct file_operations ps3vram_proc_fops = {
543 543
544static void __devinit ps3vram_proc_init(struct ps3_system_bus_device *dev) 544static void __devinit ps3vram_proc_init(struct ps3_system_bus_device *dev)
545{ 545{
546 struct ps3vram_priv *priv = dev->core.driver_data; 546 struct ps3vram_priv *priv = dev_get_drvdata(&dev->core);
547 struct proc_dir_entry *pde; 547 struct proc_dir_entry *pde;
548 548
549 pde = proc_create(DEVICE_NAME, 0444, NULL, &ps3vram_proc_fops); 549 pde = proc_create(DEVICE_NAME, 0444, NULL, &ps3vram_proc_fops);
@@ -615,9 +615,9 @@ static int __devinit ps3vram_probe(struct ps3_system_bus_device *dev)
615 } 615 }
616 616
617 mutex_init(&priv->lock); 617 mutex_init(&priv->lock);
618 dev->core.driver_data = priv; 618 dev_set_drvdata(&dev->core, priv);
619 619
620 priv = dev->core.driver_data; 620 priv = dev_get_drvdata(&dev->core);
621 621
622 /* Allocate XDR buffer (1MiB aligned) */ 622 /* Allocate XDR buffer (1MiB aligned) */
623 priv->xdr_buf = (void *)__get_free_pages(GFP_KERNEL, 623 priv->xdr_buf = (void *)__get_free_pages(GFP_KERNEL,
@@ -787,14 +787,14 @@ out_free_xdr_buf:
787 free_pages((unsigned long) priv->xdr_buf, get_order(XDR_BUF_SIZE)); 787 free_pages((unsigned long) priv->xdr_buf, get_order(XDR_BUF_SIZE));
788fail_free_priv: 788fail_free_priv:
789 kfree(priv); 789 kfree(priv);
790 dev->core.driver_data = NULL; 790 dev_set_drvdata(&dev->core, NULL);
791fail: 791fail:
792 return error; 792 return error;
793} 793}
794 794
795static int ps3vram_remove(struct ps3_system_bus_device *dev) 795static int ps3vram_remove(struct ps3_system_bus_device *dev)
796{ 796{
797 struct ps3vram_priv *priv = dev->core.driver_data; 797 struct ps3vram_priv *priv = dev_get_drvdata(&dev->core);
798 798
799 del_gendisk(priv->gendisk); 799 del_gendisk(priv->gendisk);
800 put_disk(priv->gendisk); 800 put_disk(priv->gendisk);
@@ -809,7 +809,7 @@ static int ps3vram_remove(struct ps3_system_bus_device *dev)
809 ps3_close_hv_device(dev); 809 ps3_close_hv_device(dev);
810 free_pages((unsigned long) priv->xdr_buf, get_order(XDR_BUF_SIZE)); 810 free_pages((unsigned long) priv->xdr_buf, get_order(XDR_BUF_SIZE));
811 kfree(priv); 811 kfree(priv);
812 dev->core.driver_data = NULL; 812 dev_set_drvdata(&dev->core, NULL);
813 return 0; 813 return 0;
814} 814}
815 815