Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Jun 2020 16:50:49 +0530
From:      Rajesh Kumar <rajfbsd@gmail.com>
To:        freebsd-drivers@freebsd.org, FreeBSD Hackers <freebsd-hackers@freebsd.org>
Subject:   Can we hook a device as device to two different parent devices?
Message-ID:  <CAAO%2BANOB8m6OjRY-FOVVHQi3vdcCEnHdjE2s3xoHdh0rjaTruQ@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi,

Is it really possible to declare a module with two parents? Like the
following declarations in the same driver.

devclass_t test_dev_devclass;
static DEFINE_CLASS_0(test_dev, test_dev_driver, test_dev_methods,
sizeof(struct test_dev_ctx));
DRIVER_MODULE(test_dev, *device1*, test_dev_driver, test_dev_devclass,
NULL, NULL);
DRIVER_MODULE(test_dev, *device2*, test_dev_driver, test_dev_devclass,
NULL, NULL);

I see similar references in other drivers attaching to both simpleus and
ofwbus. So, If it's possible, how to get the reference for both the
parents?  device_get_parent(test_dev) will give reference of one parent
only right, so how to get the reference of the desired parent?

Thanks,
Rajesh.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAAO%2BANOB8m6OjRY-FOVVHQi3vdcCEnHdjE2s3xoHdh0rjaTruQ>