我已經有一些Linux驅動程序可以直接從製造商處購買一些canbus硬件,但它們已經過時(至少對我的內核來說),讓我爲自己謀生。在跳過一些圈之後,我編譯時遇到了一個單一的錯誤,但這是我似乎無法動搖的錯誤。Linux驅動程序和device.h
的錯誤是這樣的:
./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驅動程序,我不知道我在看。有沒有人有這方面的經驗,可能會放棄一些提示?謝謝。
包含驅動程序期望的內核版本以及您使用的版本將會很有幫助。 – Jonathan 2011-04-13 13:52:16
我正在運行2.6.35.12-88.fc14.x86_64。我不知道司機期望什麼。我最好的參考是文檔指出,對於2.6.0以上的內核,你需要有root權限來編譯,所以我認爲它至少預計2.6.0。 – iegod 2011-04-13 14:01:13