Linux驱动程序和device.h

| 我已经直接从制造商那里获得了一些用于某些canbus硬件的Linux驱动程序,但是它们已经过时了(至少对于我的内核而言),这让我不得不自己动手。在经历了一些麻烦之后,我陷入了编译中的一个错误,但这似乎无法动摇。 错误是这样的:
./src/esdcan_pci.c:353:9: error: ‘struct device’ has no member named ‘driver_data’
经过大量的互联网搜索后,我几乎可以确定它与内核device.h的头文件有关。我已经打开了头文件并查看了该结构,可以肯定的是,没有名为driver_data的成员。我不确定哪个成员是等效成员,或者根本没有成员。这是我的头文件中结构的版本:
struct device {
    struct device       *parent;

    struct device_private   *p;

    struct kobject kobj;
    const char      *init_name; /* initial name of the device */
    struct device_type  *type;

    struct mutex        mutex;  /* mutex to synchronize calls to
                     * its driver.
                     */

    struct bus_type *bus;       /* type of bus device is on */
    struct device_driver *driver;   /* which driver has allocated this
                       device */
    void        *platform_data; /* Platform specific data, device
                       core doesn\'t touch it */
    struct dev_pm_info  power;

#ifdef CONFIG_NUMA
    int     numa_node;  /* NUMA node this device is close to */
#endif
    u64     *dma_mask;  /* dma mask (if dma\'able device) */
    u64     coherent_dma_mask;/* Like dma_mask, but for
                         alloc_coherent mappings as
                         not all hardware supports
                         64 bit addresses for consistent
                         allocations such descriptors. */

    struct device_dma_parameters *dma_parms;

    struct list_head    dma_pools;  /* dma pools (if dma\'ble) */

    struct dma_coherent_mem *dma_mem; /* internal for coherent mem
                         override */
    /* arch specific additions */
    struct dev_archdata archdata;
#ifdef CONFIG_OF
    struct device_node  *of_node;
#endif

    dev_t           devt;   /* dev_t, creates the sysfs \"dev\" */

    spinlock_t      devres_lock;
    struct list_head    devres_head;

    struct klist_node   knode_class;
    struct class        *class;
    const struct attribute_group **groups;  /* optional groups */

    void    (*release)(struct device *dev);
};
由于这是我第一次编译linux驱动程序,所以我不确定自己在看什么。有没有人在这方面有经验,可能会丢掉一些提示?谢谢。     
已邀请:
驱动程序模型已切换为使用
void * dev_get_drvdata( const struct device *dev )
void dev_set_drvdata( struct device *dev, void * data)
,而不是直接操纵
struct device
成员。您将在ѭ5中找到这些函数的原型,几乎每个设备驱动程序都使用这些调用,因此您可以轻松找到示例。 但是要注意的一件事是,几个子系统(包括PCI)的功能类似于子系统的特定版本:
pci_get_drvdata()
。但是,这些只是
dev_*
函数的包装。     

要回复问题请先登录注册