2013-02-19 115 views
1

錯誤,這真讓我頭疼想不出弄清楚什麼是錯的多行宏定義已被換行逃脫錯誤:預期的標識符或「(」編譯內核時之前數字常量

實際的錯誤是

include/linux/mmc/sdio_func.h:169:2: error: expected identifier or '(' before ')' token 
觸發錯誤

頭文件

/* 
* include/linux/mmc/sdio_func.h 
* 
* Copyright 2007-2008 Pierre Ossman 
* 
* This program is free software; you can redistribute it and/or modify 
* it under the terms of the GNU General Public License as published by 
* the Free Software Foundation; either version 2 of the License, or (at 
* your option) any later version. 
*/ 

#ifndef MMC_SDIO_FUNC_H 
#define MMC_SDIO_FUNC_H 

#include <linux/device.h> 
#include <linux/mod_devicetable.h> 

#include <linux/mmc/pm.h> 

struct mmc_card; 
struct sdio_func; 

typedef void (sdio_irq_handler_t)(struct sdio_func *); 

/* 
* Structure used to hold embedded SDIO device data from platform layer 
*/ 
struct sdio_embedded_func { 
    uint8_t f_class; 
    uint32_t f_maxblksize; 
}; 

/* 
* SDIO function CIS tuple (unknown to the core) 
*/ 
struct sdio_func_tuple { 
    struct sdio_func_tuple *next; 
    unsigned char code; 
    unsigned char size; 
    unsigned char data[0]; 
}; 

/* 
* SDIO function devices 
*/ 
struct sdio_func { 
    struct mmc_card  *card;  /* the card this device belongs to */ 
    struct device  dev;  /* the device */ 
    sdio_irq_handler_t *irq_handler; /* IRQ callback */ 
    unsigned int  num;  /* function number */ 

    unsigned char  class;  /* standard interface class */ 
    unsigned short  vendor;  /* vendor id */ 
    unsigned short  device;  /* device id */ 

    unsigned  max_blksize; /* maximum block size */ 
    unsigned  cur_blksize; /* current block size */ 

    unsigned  enable_timeout; /* max enable timeout in msec */ 

    unsigned int  state;  /* function state */ 
#define SDIO_STATE_PRESENT (1<<0)  /* present in sysfs */ 

    u8   tmpbuf[4]; /* DMA:able scratch buffer */ 

    unsigned  num_info; /* number of info strings */ 
    const char  **info;  /* info strings */ 

    struct sdio_func_tuple *tuples; 
}; 

#define sdio_func_present(f) ((f)->state & SDIO_STATE_PRESENT) 

#define sdio_func_set_present(f) ((f)->state |= SDIO_STATE_PRESENT) 

#define sdio_func_id(f)  (dev_name(&(f)->dev)) 

#define sdio_get_drvdata(f) dev_get_drvdata(&(f)->dev) 
#define sdio_set_drvdata(f,d) dev_set_drvdata(&(f)->dev, d) 
#define dev_to_sdio_func(d) container_of(d, struct sdio_func, dev) 

/* 
* SDIO function device driver 
*/ 
struct sdio_driver { 
    char *name; 
    const struct sdio_device_id *id_table; 

    int (*probe)(struct sdio_func *, const struct sdio_device_id *); 
    void (*remove)(struct sdio_func *); 

    struct device_driver drv; 
}; 

#define to_sdio_driver(d) container_of(d, struct sdio_driver, drv) 

/** 
* SDIO_DEVICE - macro used to describe a specific SDIO device 
* @vend: the 16 bit manufacturer code 
* @dev: the 16 bit function id 
* 
* This macro is used to create a struct sdio_device_id that matches a 
* specific device. The class field will be set to SDIO_ANY_ID. 
*/ 
#define SDIO_DEVICE(vend,dev) \ 
    .class = SDIO_ANY_ID, \ 
    .vendor = (vend), .device = (dev) 

/** 
* SDIO_DEVICE_CLASS - macro used to describe a specific SDIO device class 
* @dev_class: the 8 bit standard interface code 
* 
* This macro is used to create a struct sdio_device_id that matches a 
* specific standard SDIO function type. The vendor and device fields will 
* be set to SDIO_ANY_ID. 
*/ 
#define SDIO_DEVICE_CLASS(dev_class) \ 
    .class = (dev_class), \ 
    .vendor = SDIO_ANY_ID, .device = SDIO_ANY_ID 

extern int sdio_register_driver(struct sdio_driver *); 
extern void sdio_unregister_driver(struct sdio_driver *); 

/* 
* SDIO I/O operations 
*/ 
extern void sdio_claim_host(struct sdio_func *func); 
extern void sdio_release_host(struct sdio_func *func); 

extern int sdio_enable_func(struct sdio_func *func); 
extern int sdio_disable_func(struct sdio_func *func); 

extern int sdio_set_block_size(struct sdio_func *func, unsigned blksz); 

extern int sdio_claim_irq(struct sdio_func *func, sdio_irq_handler_t *handler); 
extern int sdio_release_irq(struct sdio_func *func); 

extern unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz); 

extern u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret); 
extern u8 sdio_readb_ext(struct sdio_func *func, unsigned int addr, int *err_ret, 
    unsigned in); 
extern u16 sdio_readw(struct sdio_func *func, unsigned int addr, int *err_ret); 
extern u32 sdio_readl(struct sdio_func *func, unsigned int addr, int *err_ret); 

extern int sdio_memcpy_fromio(struct sdio_func *func, void *dst, 
    unsigned int addr, int count); 
extern int sdio_readsb(struct sdio_func *func, void *dst, 
    unsigned int addr, int count); 

extern void sdio_writeb(struct sdio_func *func, u8 b, 
    unsigned int addr, int *err_ret); 
extern void sdio_writew(struct sdio_func *func, u16 b, 
    unsigned int addr, int *err_ret); 
extern void sdio_writel(struct sdio_func *func, u32 b, 
    unsigned int addr, int *err_ret); 

extern int sdio_memcpy_toio(struct sdio_func *func, unsigned int addr, 
    void *src, int count); 
extern int sdio_writesb(struct sdio_func *func, unsigned int addr, 
    void *src, int count); 

extern unsigned char sdio_f0_readb(struct sdio_func *func, 
    unsigned int addr, int *err_ret); 
extern void sdio_f0_writeb(struct sdio_func *func, unsigned char b, 
    unsigned int addr, int *err_ret); 

extern mmc_pm_flag_t sdio_get_host_pm_caps(struct sdio_func *func); 
extern int sdio_set_host_pm_flags(struct sdio_func *func, mmc_pm_flag_t flags); 

#endif 

線169的代碼#endif之前的最後一行,但看到它,我只是無法弄清楚什麼是錯w^ith。

+0

關於這兩個答案,有問題的行包含一個typedef [在linux/mmc/pm.h中定義](http://lxr.free-electrons.com/source/include/linux/mmc/pm .h?v = 2.6.34#L25),你有適當的頭文件,並且在那裏沒有宏需要,所以很奇怪你仍然看到這個......這是直接的內核代碼不是嗎?看起來你根本沒有觸及它。你在編制什麼發行版? – Mike 2013-02-19 21:01:53

回答

0

mmc_pm_flag_t類型編譯器不知道。你有沒有包含正確的標題?如果是,請檢查標題並查看是否需要啓用某些宏。

相關問題