generic devices don't have a type (char, block, etc) and are created by bus drivers to represent the device until a suitable driver is found. generic devices are registered by the bus driver. once a more suitable driver is found, that driver will re-register the device under itself.
20 lines
325 B
C
20 lines
325 B
C
#include <socks/device.h>
|
|
|
|
struct net_device *net_device_create(void)
|
|
{
|
|
struct device *dev = device_alloc();
|
|
if (!dev) {
|
|
return NULL;
|
|
}
|
|
|
|
dev->dev_type = DEV_TYPE_NET;
|
|
|
|
return NET_DEVICE(dev);
|
|
}
|
|
|
|
struct net_device *net_device_from_generic(struct device *dev)
|
|
{
|
|
dev->dev_type = DEV_TYPE_NET;
|
|
return NET_DEVICE(dev);
|
|
}
|