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
Unknown Object (File)
Thu, May 9, 2:10 AM
Unknown Object (File)
Fri, Apr 26, 2:46 AM
Unknown Object (File)
Feb 10 2024, 9:41 PM
Unknown Object (File)
Feb 3 2024, 8:22 AM
Unknown Object (File)
Jan 29 2024, 8:15 AM
Unknown Object (File)
Jan 14 2024, 7:28 AM
Unknown Object (File)
Jan 10 2024, 9:54 AM
Unknown Object (File)
Jan 9 2024, 8:32 PM

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?