Page MenuHomeFreeBSD

lkpi_i2c_del_adapter can't delete child when i2c_adapter remove
Needs ReviewPublic

Authored by shichun_ma_dell.com on Dec 27 2023, 11:27 AM.
Tags
None
Referenced Files
F99081044: D43211.diff
Sun, Oct 6, 7:30 AM
F98982923: D43211.diff
Sat, Oct 5, 3:45 PM
Unknown Object (File)
Fri, Oct 4, 6:32 AM
Unknown Object (File)
Wed, Oct 2, 4:26 AM
Unknown Object (File)
Tue, Oct 1, 6:15 PM
Unknown Object (File)
Sat, Sep 14, 3:56 AM
Unknown Object (File)
Sun, Sep 8, 12:43 PM
Unknown Object (File)
Aug 7 2024, 10:29 AM

Details

Reviewers
manu
wulf
Summary

with intel drm driver attach, then it can support monitor dynamic plug in/out. it will call i2c_add_adapter when attach monitor, and i2c_del_adapter when detach monitor.
previous code can't delete i2c device successfully. and i2c device should be deleted in each *_detach function.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Any one can have a review with this diff?

The remainder I'll leave to @manu and @wulf . I don't know enough of the implications.

sys/compat/linuxkpi/common/include/linux/device.h
517

Are you sure this is correct and doesn't lead to a leak in the destroy case?
Also seems unrelated to this problem.

sys/compat/linuxkpi/common/src/linux_i2c.c
27

That's likely not needed anymore. See fdafd315ad0d0f28a11b9fb4476a9ab059c62b92

sys/compat/linuxkpi/common/include/linux/device.h
517

devt is initialized by makdev(0, device_get_unit(dev->bsddev)); it's not resource that malloced.
so I think it's safe to set zero.

sys/compat/linuxkpi/common/src/linux_i2c.c
61

Can we avoid double creation of device children for every I2C instance? One through LKPI and than one with FreeBSD KPI?