You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When working on the Corundum device driver, I noticed a few things in the exanic kernel module that can be improved.
First, misc_dev.parent should be set to the device object before registering it. If you do that, then symlinks will be created in sysfs to cross-link the miscdevice and the PCIe device. This change is quite simple:
(looks like this needs to be done in two places, as there are two calls to misc_register)
Second, you can update exanic_get_sysfs_path to use that symlink to find the PCIe device from the miscdevice instead of one of the network interfaces by doing realpath on "/sys/class/misc/%s/device" with exanic->name. This could enable things like hot reset to work during firmware updates even if no network interfaces are registered.
Third, miscdevice already handles the find_by_minor stuff internally, and by default private_data points to the miscdevice struct. All you need to do to get a reference to the exanic struct is something like this in open, release, mmap, and ioctl:
When working on the Corundum device driver, I noticed a few things in the exanic kernel module that can be improved.
First,
misc_dev.parent
should be set to the device object before registering it. If you do that, then symlinks will be created in sysfs to cross-link the miscdevice and the PCIe device. This change is quite simple:(looks like this needs to be done in two places, as there are two calls to misc_register)
Second, you can update
exanic_get_sysfs_path
to use that symlink to find the PCIe device from the miscdevice instead of one of the network interfaces by doingrealpath
on"/sys/class/misc/%s/device"
withexanic->name
. This could enable things like hot reset to work during firmware updates even if no network interfaces are registered.Third, miscdevice already handles the find_by_minor stuff internally, and by default
private_data
points to themiscdevice
struct. All you need to do to get a reference to theexanic
struct is something like this inopen
,release
,mmap
, andioctl
:(and don't forget to leave
filp->private_data
alone inexanic_open
)The text was updated successfully, but these errors were encountered: