History

char: tile-srom: Add real platform bus parent

Add a real platform bus device as a parent for the srom class devices, to prevent non-platform devices hanging from the bus root.

Pawel Moll committed 12 years ago

Commit 514b82a1 parent 4cde4cc1 file · +12 −1Browse files

Showing the changes to drivers/char (1 of 1 file). Show all

Unified · Split

drivers/char/tile-srom.c+12−1
@@ -76,6 +76,7 @@ MODULE_LICENSE("GPL"); · 75 unmodified lines
76 76
77static int srom_devs; /* Number of SROM partitions */77static int srom_devs; /* Number of SROM partitions */
78static struct cdev srom_cdev;78static struct cdev srom_cdev;
79static struct platform_device *srom_parent;
79static struct class *srom_class;80static struct class *srom_class;
80static struct srom_dev *srom_devices;81static struct srom_dev *srom_devices;
81 82
@@ -350,7 +351,7 @@ static int srom_setup_minor(struct srom_dev *srom, int index) · 268 unmodified lines
350 SROM_PAGE_SIZE_OFF, sizeof(srom->page_size)) < 0)351 SROM_PAGE_SIZE_OFF, sizeof(srom->page_size)) < 0)
351 return -EIO;352 return -EIO;
352 353
353 dev = device_create(srom_class, &platform_bus,354 dev = device_create(srom_class, &srom_parent->dev,
354 MKDEV(srom_major, index), srom, "%d", index);355 MKDEV(srom_major, index), srom, "%d", index);
355 return PTR_ERR_OR_ZERO(dev);356 return PTR_ERR_OR_ZERO(dev);
356}357}
@@ -415,6 +416,13 @@ static int srom_init(void) · 58 unmodified lines
415 if (result < 0)416 if (result < 0)
416 goto fail_chrdev;417 goto fail_chrdev;
417 418
419 /* Create a parent device */
420 srom_parent = platform_device_register_simple("srom", -1, NULL, 0);
421 if (IS_ERR(srom_parent)) {
422 result = PTR_ERR(srom_parent);
423 goto fail_pdev;
424 }
425
418 /* Create a sysfs class. */426 /* Create a sysfs class. */
419 srom_class = class_create(THIS_MODULE, "srom");427 srom_class = class_create(THIS_MODULE, "srom");
420 if (IS_ERR(srom_class)) {428 if (IS_ERR(srom_class)) {
@@ -438,6 +446,8 @@ fail_class: · 17 unmodified lines
438 device_destroy(srom_class, MKDEV(srom_major, i));446 device_destroy(srom_class, MKDEV(srom_major, i));
439 class_destroy(srom_class);447 class_destroy(srom_class);
440fail_cdev:448fail_cdev:
449 platform_device_unregister(srom_parent);
450fail_pdev:
441 cdev_del(&srom_cdev);451 cdev_del(&srom_cdev);
442fail_chrdev:452fail_chrdev:
443 unregister_chrdev_region(dev, srom_devs);453 unregister_chrdev_region(dev, srom_devs);
@@ -454,6 +464,7 @@ static void srom_cleanup(void) · 10 unmodified lines
454 device_destroy(srom_class, MKDEV(srom_major, i));464 device_destroy(srom_class, MKDEV(srom_major, i));
455 class_destroy(srom_class);465 class_destroy(srom_class);
456 cdev_del(&srom_cdev);466 cdev_del(&srom_cdev);
467 platform_device_unregister(srom_parent);
457 unregister_chrdev_region(MKDEV(srom_major, 0), srom_devs);468 unregister_chrdev_region(MKDEV(srom_major, 0), srom_devs);
458 kfree(srom_devices);469 kfree(srom_devices);
459}470}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t