Repository navigation
Commit 2f0157f
char_dev: pin parent kobject
In certain cases (for example when a cdev structure is embedded into
another object whose lifetime is controlled by a separate kobject) it is
beneficial to tie lifetime of another object to the lifetime of
character device so that related object is not freed until after
char_dev object is freed.
To achieve this let's pin kobject's parent when doing cdev_add() and
unpin when last reference to cdev structure is being released.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>1 parent 6f0c058 commit 2f0157f
1 file changed
Lines changed: 17 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
471 | 471 | | |
472 | 472 | | |
473 | 473 | | |
| 474 | + | |
| 475 | + | |
474 | 476 | | |
475 | 477 | | |
476 | | - | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
477 | 487 | | |
478 | 488 | | |
479 | 489 | | |
| |||
498 | 508 | | |
499 | 509 | | |
500 | 510 | | |
| 511 | + | |
| 512 | + | |
501 | 513 | | |
| 514 | + | |
502 | 515 | | |
503 | 516 | | |
504 | 517 | | |
505 | 518 | | |
506 | 519 | | |
| 520 | + | |
| 521 | + | |
507 | 522 | | |
508 | 523 | | |
| 524 | + | |
509 | 525 | | |
510 | 526 | | |
511 | 527 | | |
| |||
0 commit comments