diff options
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/sysdev/axonram.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c index 7f59188cd9a1..9b639ede06da 100644 --- a/arch/powerpc/sysdev/axonram.c +++ b/arch/powerpc/sysdev/axonram.c | |||
@@ -57,6 +57,8 @@ | |||
57 | #define AXON_RAM_SECTOR_SIZE 1 << AXON_RAM_SECTOR_SHIFT | 57 | #define AXON_RAM_SECTOR_SIZE 1 << AXON_RAM_SECTOR_SHIFT |
58 | #define AXON_RAM_IRQ_FLAGS IRQF_SHARED | IRQF_TRIGGER_RISING | 58 | #define AXON_RAM_IRQ_FLAGS IRQF_SHARED | IRQF_TRIGGER_RISING |
59 | 59 | ||
60 | static int azfs_major, azfs_minor; | ||
61 | |||
60 | struct axon_ram_bank { | 62 | struct axon_ram_bank { |
61 | struct of_device *device; | 63 | struct of_device *device; |
62 | struct gendisk *disk; | 64 | struct gendisk *disk; |
@@ -227,19 +229,14 @@ axon_ram_probe(struct of_device *device, const struct of_device_id *device_id) | |||
227 | goto failed; | 229 | goto failed; |
228 | } | 230 | } |
229 | 231 | ||
230 | bank->disk->first_minor = 0; | 232 | bank->disk->major = azfs_major; |
233 | bank->disk->first_minor = azfs_minor; | ||
231 | bank->disk->fops = &axon_ram_devops; | 234 | bank->disk->fops = &axon_ram_devops; |
232 | bank->disk->private_data = bank; | 235 | bank->disk->private_data = bank; |
233 | bank->disk->driverfs_dev = &device->dev; | 236 | bank->disk->driverfs_dev = &device->dev; |
234 | 237 | ||
235 | sprintf(bank->disk->disk_name, "%s%d", | 238 | sprintf(bank->disk->disk_name, "%s%d", |
236 | AXON_RAM_DEVICE_NAME, axon_ram_bank_id); | 239 | AXON_RAM_DEVICE_NAME, axon_ram_bank_id); |
237 | bank->disk->major = register_blkdev(0, bank->disk->disk_name); | ||
238 | if (bank->disk->major < 0) { | ||
239 | dev_err(&device->dev, "Cannot register block device\n"); | ||
240 | rc = -EFAULT; | ||
241 | goto failed; | ||
242 | } | ||
243 | 240 | ||
244 | bank->disk->queue = blk_alloc_queue(GFP_KERNEL); | 241 | bank->disk->queue = blk_alloc_queue(GFP_KERNEL); |
245 | if (bank->disk->queue == NULL) { | 242 | if (bank->disk->queue == NULL) { |
@@ -276,6 +273,8 @@ axon_ram_probe(struct of_device *device, const struct of_device_id *device_id) | |||
276 | goto failed; | 273 | goto failed; |
277 | } | 274 | } |
278 | 275 | ||
276 | azfs_minor += bank->disk->minors; | ||
277 | |||
279 | return 0; | 278 | return 0; |
280 | 279 | ||
281 | failed: | 280 | failed: |
@@ -310,7 +309,6 @@ axon_ram_remove(struct of_device *device) | |||
310 | 309 | ||
311 | device_remove_file(&device->dev, &dev_attr_ecc); | 310 | device_remove_file(&device->dev, &dev_attr_ecc); |
312 | free_irq(bank->irq_id, device); | 311 | free_irq(bank->irq_id, device); |
313 | unregister_blkdev(bank->disk->major, bank->disk->disk_name); | ||
314 | del_gendisk(bank->disk); | 312 | del_gendisk(bank->disk); |
315 | iounmap((void __iomem *) bank->io_addr); | 313 | iounmap((void __iomem *) bank->io_addr); |
316 | kfree(bank); | 314 | kfree(bank); |
@@ -341,6 +339,14 @@ static struct of_platform_driver axon_ram_driver = { | |||
341 | static int __init | 339 | static int __init |
342 | axon_ram_init(void) | 340 | axon_ram_init(void) |
343 | { | 341 | { |
342 | azfs_major = register_blkdev(azfs_major, AXON_RAM_DEVICE_NAME); | ||
343 | if (azfs_major < 0) { | ||
344 | printk(KERN_ERR "%s cannot become block device major number\n", | ||
345 | AXON_RAM_MODULE_NAME); | ||
346 | return -EFAULT; | ||
347 | } | ||
348 | azfs_minor = 0; | ||
349 | |||
344 | return of_register_platform_driver(&axon_ram_driver); | 350 | return of_register_platform_driver(&axon_ram_driver); |
345 | } | 351 | } |
346 | 352 | ||
@@ -351,6 +357,7 @@ static void __exit | |||
351 | axon_ram_exit(void) | 357 | axon_ram_exit(void) |
352 | { | 358 | { |
353 | of_unregister_platform_driver(&axon_ram_driver); | 359 | of_unregister_platform_driver(&axon_ram_driver); |
360 | unregister_blkdev(azfs_major, AXON_RAM_DEVICE_NAME); | ||
354 | } | 361 | } |
355 | 362 | ||
356 | module_init(axon_ram_init); | 363 | module_init(axon_ram_init); |