From: <mar...@us...> - 2008-07-18 19:50:47
|
Revision: 201 http://openamt.svn.sourceforge.net/openamt/?rev=201&view=rev Author: marcin_obara Date: 2008-07-18 19:50:55 +0000 (Fri, 18 Jul 2008) Log Message: ----------- kernel 2.6.27 changes - cleanups Modified Paths: -------------- heci/trunk/src/heci.h heci/trunk/src/heci_data_structures.h heci/trunk/src/heci_init.c heci/trunk/src/heci_interface.c heci/trunk/src/heci_interface.h heci/trunk/src/heci_main.c heci/trunk/src/interrupt.c heci/trunk/src/io_heci.c Modified: heci/trunk/src/heci.h =================================================================== --- heci/trunk/src/heci.h 2008-07-17 18:31:29 UTC (rev 200) +++ heci/trunk/src/heci.h 2008-07-18 19:50:55 UTC (rev 201) @@ -55,11 +55,11 @@ extern const struct guid heci_pthi_guid; extern const struct guid heci_wd_guid; -extern const __u8 start_wd_params[]; -extern const __u8 stop_wd_params[]; +extern const __u8 heci_start_wd_params[]; +extern const __u8 heci_stop_wd_params[]; extern const __u8 heci_wd_state_independence_msg[3][4]; -/** +/* * heci device ID */ #define HECI_DEV_ID_82946GZ 0x2974 /* 82946GZ/GL */ @@ -92,7 +92,7 @@ #define HECI_DEV_ID_ICH10_3 0x2E24 /* Eaglelake */ #define HECI_DEV_ID_ICH10_4 0x2E34 /* Eaglelake */ -/** +/* * heci init function prototypes */ struct iamt_heci_device *init_heci_device(struct pci_dev *pdev); @@ -113,48 +113,48 @@ void heci_remove_client_from_file_list(struct iamt_heci_device *dev, __u8 host_client_id); -/** +/* * interrupt function prototype */ irqreturn_t heci_isr_interrupt(int irq, void *dev_id); void heci_wd_timer(unsigned long data); -/** +/* * input output function prototype */ -int heci_ioctl_get_version(struct iamt_heci_device *device, int if_num, +int heci_ioctl_get_version(struct iamt_heci_device *dev, int if_num, struct heci_message_data *u_msg, struct heci_message_data k_msg, struct heci_file_private *file_ext); -int heci_ioctl_connect_client(struct iamt_heci_device *device, int if_num, +int heci_ioctl_connect_client(struct iamt_heci_device *dev, int if_num, struct heci_message_data *u_msg, struct heci_message_data k_msg, struct file *file); -int heci_ioctl_wd(struct iamt_heci_device *device, int if_num, +int heci_ioctl_wd(struct iamt_heci_device *dev, int if_num, struct heci_message_data k_msg, struct heci_file_private *file_ext); -int heci_ioctl_bypass_wd(struct iamt_heci_device *device, int if_num, +int heci_ioctl_bypass_wd(struct iamt_heci_device *dev, int if_num, struct heci_message_data k_msg, struct heci_file_private *file_ext); -int heci_start_read(struct iamt_heci_device *device, int if_num, +int heci_start_read(struct iamt_heci_device *dev, int if_num, struct heci_file_private *file_ext); -int pthi_write(struct iamt_heci_device *device, +int pthi_write(struct iamt_heci_device *dev, struct heci_cb_private *priv_cb); -int pthi_read(struct iamt_heci_device *device, int if_num, struct file *file, +int pthi_read(struct iamt_heci_device *dev, int if_num, struct file *file, char *ubuf, size_t length, loff_t *offset); struct heci_cb_private *find_pthi_read_list_entry( - struct iamt_heci_device *device, + struct iamt_heci_device *dev, struct file *file); -void run_next_iamthif_cmd(struct iamt_heci_device *device); +void run_next_iamthif_cmd(struct iamt_heci_device *dev); void heci_free_cb_private(struct heci_cb_private *priv_cb); @@ -164,10 +164,10 @@ * @fe1: private data of 1. file object * @fe2: private data of 2. file object * - * @return !=0 - if ids are the same, 0 - if differ. + * returns !=0 - if ids are the same, 0 - if differ. */ -static inline int heci_fe_same_id(struct heci_file_private *fe1, - struct heci_file_private *fe2) +static inline int heci_fe_same_id(const struct heci_file_private *fe1, + const struct heci_file_private *fe2) { return ((fe1->host_client_id == fe2->host_client_id) && (fe1->me_client_id == fe2->me_client_id)); Modified: heci/trunk/src/heci_data_structures.h =================================================================== --- heci/trunk/src/heci_data_structures.h 2008-07-17 18:31:29 UTC (rev 200) +++ heci/trunk/src/heci_data_structures.h 2008-07-18 19:50:55 UTC (rev 201) @@ -52,7 +52,7 @@ #include <linux/aio.h> #include <linux/types.h> -/** +/* * error code definition */ #define ESLOTS_OVERFLOW 1 @@ -61,18 +61,18 @@ #define HECI_FC_MESSAGE_RESERVED_LENGTH 5 -/** +/* * Number of queue lists used by this driver */ #define HECI_IO_LISTS_NUMBER 7 -/** +/* * Maximum transmission unit (MTU) of heci messages */ #define IAMTHIF_MTU 4160 -/** +/* * HECI HW Section */ @@ -131,23 +131,29 @@ #define HECI_MINOR_NUMBER 1 #define HECI_MAX_OPEN_HANDLE_COUNT 253 -/** +/* * debug kernel print macro define */ extern int heci_debug; +extern struct device *heci_dev; #define DBG(format, arg...) do { \ - if (heci_debug) \ - printk(KERN_ERR "%s: " format , __func__ , ## arg); \ + if (heci_debug) { \ + if (heci_dev) \ + dev_info(heci_dev, "%s: " format, __func__, ## arg); \ + else \ + printk(KERN_INFO "heci: %s: " format, \ + __func__, ## arg); \ + } \ } while (0) -/** +/* * time to wait HECI become ready after init */ #define HECI_INTEROP_TIMEOUT (HZ * 7) -/** +/* * watch dog definition */ #define HECI_WATCHDOG_DATA_SIZE 16 @@ -163,7 +169,7 @@ __u16 data2; __u16 data3; __u8 data4[8]; -} __attribute__((packed)); +}; /* File state */ enum file_state { @@ -503,22 +509,28 @@ /** * read_heci_register - Read a byte from the heci device * - * @device: the device structure + * @dev: the device structure * @offset: offset from which to read the data * - * @return the byte read. + * returns the byte read. */ -__u32 read_heci_register(struct iamt_heci_device *device, - unsigned long offset); +static inline __u32 read_heci_register(struct iamt_heci_device *dev, + unsigned long offset) +{ + return readl(dev->mem_addr + offset); +} /** * write_heci_register - Write 4 bytes to the heci device * - * @device: the device structure + * @dev: the device structure * @offset: offset from which to write the data * @value: the byte to write */ -void write_heci_register(struct iamt_heci_device *device, unsigned long offset, - __u32 value); +static inline void write_heci_register(struct iamt_heci_device *dev, + unsigned long offset, __u32 value) +{ + writel(value, dev->mem_addr + offset); +} #endif /* _HECI_DATA_STRUCTURES_H_ */ Modified: heci/trunk/src/heci_init.c =================================================================== --- heci/trunk/src/heci_init.c 2008-07-17 18:31:29 UTC (rev 200) +++ heci/trunk/src/heci_init.c 2008-07-18 19:50:55 UTC (rev 201) @@ -55,11 +55,8 @@ #include "heci.h" -const __u8 watch_dog_data[] = { - 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 -}; -const __u8 start_wd_params[] = { 0x02, 0x12, 0x13, 0x10 }; -const __u8 stop_wd_params[] = { 0x02, 0x02, 0x14, 0x10 }; +const __u8 heci_start_wd_params[] = { 0x02, 0x12, 0x13, 0x10 }; +const __u8 heci_stop_wd_params[] = { 0x02, 0x02, 0x14, 0x10 }; const __u8 heci_wd_state_independence_msg[3][4] = { {0x05, 0x02, 0x51, 0x10}, @@ -81,7 +78,7 @@ }; -/** +/* * heci init function prototypes */ static void heci_check_asf_mode(struct iamt_heci_device *dev); @@ -95,7 +92,7 @@ /** - * heci_initialize_list - Sets up a queue list. + * heci_initialize_list - Sets up a queue list. * * @list: An instance of our list structure * @dev: Device object for our driver @@ -114,7 +111,6 @@ * * @dev: Device object for our driver * @file_ext: private data of the file object - * */ void heci_flush_queues(struct iamt_heci_device *dev, struct heci_file_private *file_ext) @@ -169,6 +165,7 @@ /** * heci_reset_iamthif_params - initializes heci device iamthif + * * @dev: The heci device structure */ static void heci_reset_iamthif_params(struct iamt_heci_device *dev) @@ -186,42 +183,43 @@ /** * init_heci_device - allocates and initializes the heci device structure + * * @pdev: The pci device structure * - * @return The heci_device_device pointer on success, NULL on failure. + * returns The heci_device_device pointer on success, NULL on failure. */ struct iamt_heci_device *init_heci_device(struct pci_dev *pdev) { int i; - struct iamt_heci_device *device; + struct iamt_heci_device *dev; - device = kzalloc(sizeof(struct iamt_heci_device), GFP_KERNEL); - if (!device) + dev = kzalloc(sizeof(struct iamt_heci_device), GFP_KERNEL); + if (!dev) return NULL; /* setup our list array */ - device->io_list_array[0] = &device->read_list; - device->io_list_array[1] = &device->write_list; - device->io_list_array[2] = &device->write_waiting_list; - device->io_list_array[3] = &device->ctrl_wr_list; - device->io_list_array[4] = &device->ctrl_rd_list; - device->io_list_array[5] = &device->pthi_cmd_list; - device->io_list_array[6] = &device->pthi_read_complete_list; - INIT_LIST_HEAD(&device->file_list); - INIT_LIST_HEAD(&device->wd_file_ext.link); - INIT_LIST_HEAD(&device->iamthif_file_ext.link); - spin_lock_init(&device->device_lock); - init_waitqueue_head(&device->wait_recvd_msg); - init_waitqueue_head(&device->wait_stop_wd); - device->heci_state = HECI_INITIALIZING; - device->iamthif_state = HECI_IAMTHIF_IDLE; + dev->io_list_array[0] = &dev->read_list; + dev->io_list_array[1] = &dev->write_list; + dev->io_list_array[2] = &dev->write_waiting_list; + dev->io_list_array[3] = &dev->ctrl_wr_list; + dev->io_list_array[4] = &dev->ctrl_rd_list; + dev->io_list_array[5] = &dev->pthi_cmd_list; + dev->io_list_array[6] = &dev->pthi_read_complete_list; + INIT_LIST_HEAD(&dev->file_list); + INIT_LIST_HEAD(&dev->wd_file_ext.link); + INIT_LIST_HEAD(&dev->iamthif_file_ext.link); + spin_lock_init(&dev->device_lock); + init_waitqueue_head(&dev->wait_recvd_msg); + init_waitqueue_head(&dev->wait_stop_wd); + dev->heci_state = HECI_INITIALIZING; + dev->iamthif_state = HECI_IAMTHIF_IDLE; /* init work for schedule work */ - INIT_WORK(&device->work, NULL); + INIT_WORK(&dev->work, NULL); for (i = 0; i < HECI_IO_LISTS_NUMBER; i++) - heci_initialize_list(device->io_list_array[i], device); - device->pdev = pdev; - return device; + heci_initialize_list(dev->io_list_array[i], dev); + dev->pdev = pdev; + return dev; } @@ -239,7 +237,7 @@ * * @dev: Device object for our driver * - * @return 0 on success, <0 on failure. + * returns 0 on success, <0 on failure. */ int heci_hw_init(struct iamt_heci_device *dev) { @@ -299,7 +297,7 @@ } /** - * heci_hw_reset - reset fw via heci csr register. + * heci_hw_reset - reset fw via heci csr register. * * @dev: Device object for our driver * @interrupts: if interrupt should be enable after reset. @@ -318,7 +316,7 @@ } /** - * heci_reset - reset host and fw. + * heci_reset - reset host and fw. * * @dev: Device object for our driver * @interrupts: if interrupt should be enable after reset. @@ -402,7 +400,7 @@ dev->host_hw_state, dev->me_hw_state); if (unexpected) - printk(KERN_WARNING "unexpected heci reset.\n"); + printk(KERN_WARNING "heci: unexpected reset.\n"); /* Wake up all readings so they can be interrupted */ list_for_each_entry_safe(file_pos, file_next, &dev->file_list, link) { @@ -426,10 +424,9 @@ } /** - * heci_initialize_clients - routine. + * heci_initialize_clients - heci communication initialization. * * @dev: Device object for our driver - * */ int heci_initialize_clients(struct iamt_heci_device *dev) { @@ -446,8 +443,8 @@ DBG("start sending messages failed.\n"); return status; } - /* enumerate clients */ + /* enumerate clients */ status = host_enum_clients_message(dev); if (status != 0) { spin_lock_bh(&dev->device_lock); @@ -492,10 +489,9 @@ } /** - * heci_task_initialize_clients - routine. + * heci_task_initialize_clients - heci reinitialization task * * @data: Device object for our driver - * */ int heci_task_initialize_clients(void *data) { @@ -526,7 +522,7 @@ * * @dev: Device object for our driver * - * @return 0 on success, <0 on failure. + * returns 0 on success, <0 on failure. */ static int host_start_message(struct iamt_heci_device *dev) { @@ -596,7 +592,8 @@ * host_enum_clients_message - host send enumeration client request message. * * @dev: Device object for our driver - * @return 0 on success, <0 on failure. + * + * returns 0 on success, <0 on failure. */ static int host_enum_clients_message(struct iamt_heci_device *dev) { @@ -654,7 +651,7 @@ * @idx: client index in me client array * @client_id: id of the client * - * @return 0 on success, <0 on failure. + * returns 0 on success, <0 on failure. */ static int host_client_properties(struct iamt_heci_device *dev, struct heci_me_client *client) @@ -696,7 +693,7 @@ * * @dev: Device object for our driver * - * @return 0 on success, <0 on failure. + * returns 0 on success, <0 on failure. */ static int allocate_me_clients_storage(struct iamt_heci_device *dev) { @@ -753,7 +750,6 @@ * * @priv: private file structure to be initialized * @file: the file structure - * */ static void heci_init_file_private(struct heci_file_private *priv, struct file *file) @@ -779,7 +775,7 @@ * @cguid: searched guid of ME client * @client_id: id of host client to be set in file private structure * - * @return ME client index + * returns ME client index */ static __u8 heci_find_me_client(struct iamt_heci_device *dev, struct heci_file_private *priv, @@ -809,7 +805,6 @@ * heci_check_asf_mode - check for ASF client * * @dev: Device object for our driver - * */ static void heci_check_asf_mode(struct iamt_heci_device *dev) { @@ -839,7 +834,7 @@ * @priv: private file structure * @timeout: connect timeout in seconds * - * @return 1 - if connected, 0 - if not + * returns 1 - if connected, 0 - if not */ static __u8 heci_connect_me_client(struct iamt_heci_device *dev, struct heci_file_private *priv, @@ -884,11 +879,9 @@ * host_init_wd - heci initialization wd. * * @dev: Device object for our driver - * */ static void host_init_wd(struct iamt_heci_device *dev) { - spin_lock_bh(&dev->device_lock); heci_init_file_private(&dev->wd_file_ext, NULL); @@ -898,12 +891,12 @@ dev->wd_timeout = 0; if (dev->asf_mode) { - memcpy(dev->wd_data, stop_wd_params, HECI_WD_PARAMS_SIZE); + memcpy(dev->wd_data, heci_stop_wd_params, HECI_WD_PARAMS_SIZE); } else { /* AMT mode */ dev->wd_timeout = AMT_WD_VALUE; DBG("dev->wd_timeout=%d.\n", dev->wd_timeout); - memcpy(dev->wd_data, start_wd_params, HECI_WD_PARAMS_SIZE); + memcpy(dev->wd_data, heci_start_wd_params, HECI_WD_PARAMS_SIZE); memcpy(dev->wd_data + HECI_WD_PARAMS_SIZE, &dev->wd_timeout, sizeof(__u16)); } @@ -971,7 +964,7 @@ * heci_alloc_file_private - allocates a private file structure and set it up. * @file: the file structure * - * @return The allocated file or NULL on failure + * returns The allocated file or NULL on failure */ struct heci_file_private *heci_alloc_file_private(struct file *file) { @@ -989,12 +982,12 @@ /** - * heci_disconnect_host_client - send disconnect message to fw from host client. + * heci_disconnect_host_client - send disconnect message to fw from host client. * * @dev: Device object for our driver * @file_ext: private data of the file object * - * @return 0 on success, <0 on failure. + * returns 0 on success, <0 on failure. */ int heci_disconnect_host_client(struct iamt_heci_device *dev, struct heci_file_private *file_ext) @@ -1062,12 +1055,11 @@ } /** - * heci_remove_client_from_file_list - + * heci_remove_client_from_file_list - * remove file private data from device file list * * @dev: Device object for our driver * @host_client_id: host client id to be removed - * */ void heci_remove_client_from_file_list(struct iamt_heci_device *dev, __u8 host_client_id) Modified: heci/trunk/src/heci_interface.c =================================================================== --- heci/trunk/src/heci_interface.c 2008-07-17 18:31:29 UTC (rev 200) +++ heci/trunk/src/heci_interface.c 2008-07-18 19:50:55 UTC (rev 201) @@ -43,39 +43,7 @@ #include "heci_interface.h" - -static const __u8 interface_start_wd_params[] = { 0x02, 0x12, 0x13, 0x10}; -static const __u8 interface_stop_wd_params[] = { 0x02, 0x02, 0x14, 0x10}; - /** - * read_heci_register - Read a byte from the heci device - * - * @device: the device structure - * @offset: offset from which to read the data - * - * @return the byte read. - */ -__u32 read_heci_register(struct iamt_heci_device *device, - unsigned long offset) -{ - return readl(device->mem_addr + offset); -} - -/** - * write_heci_register - Write 4 bytes to the heci device - * - * @device: the device structure - * @offset: offset from which to write the data - * @value: the byte to write - */ -void write_heci_register(struct iamt_heci_device *device, unsigned long offset, - __u32 value) -{ - writel(value, device->mem_addr + offset); -} - - -/** * heci_set_csr_register - write H_CSR register to the heci device * * @dev: device object for our driver @@ -114,9 +82,9 @@ * * @device: the device structure * - * @return numer of filled slots + * returns numer of filled slots */ -static unsigned char _host_get_filled_slots(struct iamt_heci_device *dev) +static unsigned char _host_get_filled_slots(const struct iamt_heci_device *dev) { char read_ptr, write_ptr; @@ -131,7 +99,7 @@ * * @dev: device object for our driver * - * @return 1 if empty, 0 - otherwise. + * returns 1 if empty, 0 - otherwise. */ int host_buffer_is_empty(struct iamt_heci_device *dev) { @@ -151,9 +119,9 @@ * * @dev: device object for our driver * - * @return -1(ESLOTS_OVERFLOW) if overflow, otherwise empty slots count + * returns -1(ESLOTS_OVERFLOW) if overflow, otherwise empty slots count */ -__s32 count_empty_write_slots(struct iamt_heci_device *dev) +__s32 count_empty_write_slots(const struct iamt_heci_device *dev) { unsigned char buffer_depth, filled_slots, empty_slots; @@ -177,7 +145,7 @@ * @write_buffer: message buffer will be write * @write_length: message size will be write * - * @return 1 if success, 0 - otherwise. + * returns 1 if success, 0 - otherwise. */ int heci_write_message(struct iamt_heci_device *dev, struct heci_msg_hdr *header, @@ -231,7 +199,7 @@ * * @dev: device object for our driver * - * @return -1(ESLOTS_OVERFLOW) if overflow, otherwise filled slots count + * returns -1(ESLOTS_OVERFLOW) if overflow, otherwise filled slots count */ __s32 count_full_read_slots(struct iamt_heci_device *dev) { @@ -288,7 +256,7 @@ * @dev: device object for our driver * @file_ext: private data of the file object * - * @return 1 if flow_ctrl_creds >0, 0 - otherwise. + * returns 1 if flow_ctrl_creds >0, 0 - otherwise. */ int flow_ctrl_creds(struct iamt_heci_device *dev, struct heci_file_private *file_ext) @@ -353,7 +321,7 @@ * @dev: device object for our driver * @file_ext: private data of the file object * - * @return 1 if success, 0 - otherwise. + * returns 1 if success, 0 - otherwise. */ int heci_send_flow_control(struct iamt_heci_device *dev, struct heci_file_private *file_ext) @@ -388,19 +356,19 @@ /** * other_client_is_connecting - check if other - * client with the same client id is connected. + * client with the same client id is connected. * * @dev: device object for our driver * @file_ext: private data of the file object * - * @return 1 if other client is connected, 0 - otherwise. + * returns 1 if other client is connected, 0 - otherwise. */ int other_client_is_connecting(struct iamt_heci_device *dev, struct heci_file_private *file_ext) { - struct heci_file_private *file_pos = NULL; struct heci_file_private *file_next = NULL; + list_for_each_entry_safe(file_pos, file_next, &dev->file_list, link) { if ((file_pos->state == HECI_FILE_CONNECTING) && (file_pos != file_ext) @@ -416,7 +384,7 @@ * * @dev: device object for our driver * - * @return 1 if success, 0 - otherwise. + * returns 1 if success, 0 - otherwise. */ int heci_send_wd(struct iamt_heci_device *dev) { @@ -428,11 +396,11 @@ heci_hdr->msg_complete = 1; heci_hdr->reserved = 0; - if (!memcmp(dev->wd_data, interface_start_wd_params, + if (!memcmp(dev->wd_data, heci_start_wd_params, HECI_WD_PARAMS_SIZE)) { heci_hdr->length = HECI_START_WD_DATA_SIZE; } else { - BUG_ON(memcmp(dev->wd_data, interface_stop_wd_params, + BUG_ON(memcmp(dev->wd_data, heci_stop_wd_params, HECI_WD_PARAMS_SIZE)); heci_hdr->length = HECI_WD_PARAMS_SIZE; } @@ -449,7 +417,7 @@ * @dev: device object for our driver * @file_ext: private data of the file object * - * @return 1 if success, 0 - otherwise. + * returns 1 if success, 0 - otherwise. */ int heci_disconnect(struct iamt_heci_device *dev, struct heci_file_private *file_ext) @@ -486,7 +454,7 @@ * @dev: device object for our driver * @file_ext: private data of the file object * - * @return 1 if success, 0 - otherwise. + * returns 1 if success, 0 - otherwise. */ int heci_connect(struct iamt_heci_device *dev, struct heci_file_private *file_ext) Modified: heci/trunk/src/heci_interface.h =================================================================== --- heci/trunk/src/heci_interface.h 2008-07-17 18:31:29 UTC (rev 200) +++ heci/trunk/src/heci_interface.h 2008-07-18 19:50:55 UTC (rev 201) @@ -128,7 +128,7 @@ }; -/** +/* * heci interface function prototypes */ void heci_set_csr_register(struct iamt_heci_device *dev); @@ -147,7 +147,7 @@ __s32 count_full_read_slots(struct iamt_heci_device *dev); -__s32 count_empty_write_slots(struct iamt_heci_device *dev); +__s32 count_empty_write_slots(const struct iamt_heci_device *dev); int flow_ctrl_creds(struct iamt_heci_device *dev, struct heci_file_private *file_ext); Modified: heci/trunk/src/heci_main.c =================================================================== --- heci/trunk/src/heci_main.c 2008-07-17 18:31:29 UTC (rev 200) +++ heci/trunk/src/heci_main.c 2008-07-18 19:50:55 UTC (rev 201) @@ -69,7 +69,7 @@ #define HECI_DRIVER_NAME "heci" -/** +/* * heci driver strings */ char heci_driver_name[] = HECI_DRIVER_NAME; @@ -98,7 +98,7 @@ static struct pci_dev *heci_device; struct class *heci_class; -struct class_device *heci_class_dev; +struct device *heci_dev; /* heci_pci_tbl - PCI Device ID Table */ @@ -133,7 +133,7 @@ MODULE_DEVICE_TABLE(pci, heci_pci_tbl); -/** +/* * Local Function Prototypes */ static int __init heci_init_module(void); @@ -161,7 +161,7 @@ #define heci_suspend NULL #define heci_resume NULL #endif -/** +/* * PCI driver structure */ static struct pci_driver heci_driver = { @@ -174,7 +174,7 @@ .resume = heci_resume }; -/** +/* * file operations structure will be use heci char device. */ static struct file_operations heci_fops = { @@ -188,13 +188,13 @@ }; /** - * Set up the cdev structure for heci device. + * heci_registration_cdev - set up the cdev structure for heci device. * * @dev: char device struct * @hminor: minor number for registration char device * @fops: file operations structure * - * @return 0 on success, <0 on failure. + * returns 0 on success, <0 on failure. */ static int heci_registration_cdev(struct cdev *dev, int hminor, struct file_operations *fops) @@ -224,7 +224,7 @@ /** * heci_register_cdev - registers heci char device * - * @return 0 on success, <0 on failure. + * returns 0 on success, <0 on failure. */ static int heci_register_cdev(void) { @@ -263,12 +263,12 @@ /** * heci_sysfs_device_create - adds device entry to sysfs * - * @return 0 on success, <0 on failure. + * returns 0 on success, <0 on failure. */ static int heci_sysfs_device_create(void) { struct class *class; - void *tmphdev; + struct device *tmphdev; int err = 0; class = class_create(THIS_MODULE, HECI_DRIVER_NAME); @@ -285,8 +285,7 @@ goto err_out; } - tmphdev = (void *) device_create(class, NULL, heci_cdev.dev, - HECI_DEV_NAME); + tmphdev = device_create(class, NULL, heci_cdev.dev, HECI_DEV_NAME); if (IS_ERR(tmphdev)) { err = PTR_ERR(tmphdev); class_remove_file(class, &class_attr_version); @@ -294,6 +293,7 @@ goto err_out; } + heci_dev = tmphdev; heci_class = class; err_out: return err; @@ -307,6 +307,7 @@ if ((heci_class == NULL) || (IS_ERR(heci_class))) return; + heci_dev = NULL; device_destroy(heci_class, heci_cdev.dev); class_remove_file(heci_class, &class_attr_version); class_destroy(heci_class); @@ -318,7 +319,7 @@ * heci_init_module is the first routine called when the driver is * loaded. All it does is register with the PCI subsystem. * - * @return 0 on success, <0 on failure. + * returns 0 on success, <0 on failure. */ static int __init heci_init_module(void) { @@ -378,7 +379,7 @@ * @pdev: PCI device information struct * @ent: entry in kcs_pci_tbl * - * @return 0 on success, <0 on failure. + * returns 0 on success, <0 on failure. */ static int __devinit heci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) @@ -415,7 +416,7 @@ if (pci_resource_len(pdev, i) == 0) continue; if (pci_resource_flags(pdev, i) & IORESOURCE_IO) { - printk(KERN_ERR "heci has IO ports.\n"); + printk(KERN_ERR "heci: heci has IO ports.\n"); goto free_device; } else if (pci_resource_flags(pdev, i) & IORESOURCE_MEM) { if (dev->mem_base) { @@ -534,7 +535,7 @@ && dev->wd_timeout) { dev->wd_timeout = 0; dev->wd_due_counter = 0; - memcpy(dev->wd_data, stop_wd_params, HECI_WD_PARAMS_SIZE); + memcpy(dev->wd_data, heci_stop_wd_params, HECI_WD_PARAMS_SIZE); dev->stop = 1; if (dev->host_buffer_is_empty && flow_ctrl_creds(dev, &dev->wd_file_ext)) { @@ -618,7 +619,7 @@ * heci_clear_list is called to clear resources associated with file * when application calls close function or Ctrl-C was pressed * - * @return 1 if callback removed from the list, 0 otherwise + * returns 1 if callback removed from the list, 0 otherwise */ static int heci_clear_list(struct iamt_heci_device *dev, struct file *file, struct list_head *heci_cb_list) @@ -660,7 +661,7 @@ * heci_clear_lists is called to clear resources associated with file * when application calls close function or Ctrl-C was pressed * - * @return 1 if callback removed from the list, 0 otherwise + * returns 1 if callback removed from the list, 0 otherwise */ static int heci_clear_lists(struct iamt_heci_device *dev, struct file *file) { @@ -699,6 +700,11 @@ /** * heci_open - the open function + * + * @inode: pointer to inode structure + * @file: pointer to file structure + * + * returns 0 on success, <0 on error */ static int heci_open(struct inode *inode, struct file *file) { @@ -756,6 +762,11 @@ /** * heci_release - the release function + * + * @inode: pointer to inode structure + * @file: pointer to file structure + * + * returns 0 on success, <0 on error */ static int heci_release(struct inode *inode, struct file *file) { @@ -871,6 +882,13 @@ /** * heci_read - the read client message function. + * + * @file: pointer to file structure + * @ubuf: pointer to user buffer + * @length: buffer length + * @offset: data offset in buffer + * + * returns >=0 data length on success , <0 on error */ static ssize_t heci_read(struct file *file, char __user *ubuf, size_t length, loff_t *offset) @@ -1033,6 +1051,13 @@ /** * heci_write - the write function. + * + * @file: pointer to file structure + * @ubuf: pointer to user buffer + * @length: buffer length + * @offset: data offset in buffer + * + * returns >=0 data length on success , <0 on error */ static ssize_t heci_write(struct file *file, const char __user *ubuf, size_t length, loff_t *offset) @@ -1291,6 +1316,13 @@ /** * heci_ioctl - the IOCTL function + * + * @inode: pointer to inode structure + * @file: pointer to file structure + * @cmd: ioctl command + * @data: pointer to heci message structure + * + * returns 0 on success , <0 on error */ static int heci_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data) @@ -1359,6 +1391,11 @@ /** * heci_poll - the poll function + * + * @file: pointer to file structure + * @wait: pointer to poll_table structure + * + * returns poll mask */ static unsigned int heci_poll(struct file *file, poll_table *wait) { @@ -1410,45 +1447,46 @@ #ifdef CONFIG_PM static int heci_suspend(struct pci_dev *pdev, pm_message_t state) { - struct iamt_heci_device *device = pci_get_drvdata(pdev); + struct iamt_heci_device *dev = pci_get_drvdata(pdev); int err = 0; - spin_lock_bh(&device->device_lock); - if (device->reinit_tsk != NULL) { - kthread_stop(device->reinit_tsk); - device->reinit_tsk = NULL; + spin_lock_bh(&dev->device_lock); + if (dev->reinit_tsk != NULL) { + kthread_stop(dev->reinit_tsk); + dev->reinit_tsk = NULL; } - spin_unlock_bh(&device->device_lock); + spin_unlock_bh(&dev->device_lock); /* Stop watchdog if exists */ - del_timer_sync(&device->wd_timer); - if (device->wd_file_ext.state == HECI_FILE_CONNECTED - && device->wd_timeout) { - spin_lock_bh(&device->device_lock); - g_sus_wd_timeout = device->wd_timeout; - device->wd_timeout = 0; - device->wd_due_counter = 0; - memcpy(device->wd_data, stop_wd_params, HECI_WD_PARAMS_SIZE); - device->stop = 1; - if (device->host_buffer_is_empty && - flow_ctrl_creds(device, &device->wd_file_ext)) { - device->host_buffer_is_empty = 0; - if (!heci_send_wd(device)) + del_timer_sync(&dev->wd_timer); + if (dev->wd_file_ext.state == HECI_FILE_CONNECTED + && dev->wd_timeout) { + spin_lock_bh(&dev->device_lock); + g_sus_wd_timeout = dev->wd_timeout; + dev->wd_timeout = 0; + dev->wd_due_counter = 0; + memcpy(dev->wd_data, heci_stop_wd_params, + HECI_WD_PARAMS_SIZE); + dev->stop = 1; + if (dev->host_buffer_is_empty && + flow_ctrl_creds(dev, &dev->wd_file_ext)) { + dev->host_buffer_is_empty = 0; + if (!heci_send_wd(dev)) DBG("send stop WD failed\n"); else - flow_ctrl_reduce(device, &device->wd_file_ext); + flow_ctrl_reduce(dev, &dev->wd_file_ext); - device->wd_pending = 0; + dev->wd_pending = 0; } else { - device->wd_pending = 1; + dev->wd_pending = 1; } - spin_unlock_bh(&device->device_lock); - device->wd_stoped = 0; + spin_unlock_bh(&dev->device_lock); + dev->wd_stoped = 0; - err = wait_event_interruptible_timeout(device->wait_stop_wd, - (device->wd_stoped), + err = wait_event_interruptible_timeout(dev->wait_stop_wd, + (dev->wd_stoped), 10 * HZ); - if (!device->wd_stoped) + if (!dev->wd_stoped) DBG("stop wd failed to complete.\n"); else { DBG("stop wd complete %d.\n", err); @@ -1456,18 +1494,18 @@ } } /* Set new heci state */ - spin_lock_bh(&device->device_lock); - if (device->heci_state == HECI_ENABLED || - device->heci_state == HECI_RECOVERING_FROM_RESET) { - device->heci_state = HECI_POWER_DOWN; - heci_reset(device, 0); + spin_lock_bh(&dev->device_lock); + if (dev->heci_state == HECI_ENABLED || + dev->heci_state == HECI_RECOVERING_FROM_RESET) { + dev->heci_state = HECI_POWER_DOWN; + heci_reset(dev, 0); } - spin_unlock_bh(&device->device_lock); + spin_unlock_bh(&dev->device_lock); pci_save_state(pdev); pci_disable_device(pdev); - free_irq(pdev->irq, device); + free_irq(pdev->irq, dev); pci_set_power_state(pdev, PCI_D3hot); @@ -1476,41 +1514,42 @@ static int heci_resume(struct pci_dev *pdev) { - struct iamt_heci_device *device; + struct iamt_heci_device *dev; int err = 0; pci_set_power_state(pdev, PCI_D0); pci_restore_state(pdev); - device = pci_get_drvdata(pdev); - if (!device) + dev = pci_get_drvdata(pdev); + if (!dev) return -ENODEV; /* request and enable interrupt */ err = request_irq(pdev->irq, heci_isr_interrupt, IRQF_SHARED, - heci_driver_name, device); + heci_driver_name, dev); if (err) { printk(KERN_ERR "heci: Request_irq failure. irq = %d \n", pdev->irq); return err; } - spin_lock_bh(&device->device_lock); - device->heci_state = HECI_POWER_UP; - heci_reset(device, 1); - spin_unlock_bh(&device->device_lock); + spin_lock_bh(&dev->device_lock); + dev->heci_state = HECI_POWER_UP; + heci_reset(dev, 1); + spin_unlock_bh(&dev->device_lock); /* Start watchdog if stopped in suspend */ if (g_sus_wd_timeout != 0) { - device->wd_timeout = g_sus_wd_timeout; + dev->wd_timeout = g_sus_wd_timeout; - memcpy(device->wd_data, start_wd_params, HECI_WD_PARAMS_SIZE); - memcpy(device->wd_data + HECI_WD_PARAMS_SIZE, - &device->wd_timeout, sizeof(__u16)); - device->wd_due_counter = 1; + memcpy(dev->wd_data, heci_start_wd_params, + HECI_WD_PARAMS_SIZE); + memcpy(dev->wd_data + HECI_WD_PARAMS_SIZE, + &dev->wd_timeout, sizeof(__u16)); + dev->wd_due_counter = 1; - if (device->wd_timeout) - mod_timer(&device->wd_timer, jiffies); + if (dev->wd_timeout) + mod_timer(&dev->wd_timer, jiffies); g_sus_wd_timeout = 0; } Modified: heci/trunk/src/interrupt.c =================================================================== --- heci/trunk/src/interrupt.c 2008-07-17 18:31:29 UTC (rev 200) +++ heci/trunk/src/interrupt.c 2008-07-18 19:50:55 UTC (rev 201) @@ -44,7 +44,7 @@ #include "heci.h" #include "heci_interface.h" -/** +/* * interrupt function prototypes */ static void heci_bh_handler(struct work_struct *work); @@ -78,29 +78,29 @@ * @irq: The irq number * @dev_id: pointer to the device structure * - * @return irqreturn_t + * returns irqreturn_t */ irqreturn_t heci_isr_interrupt(int irq, void *dev_id) { int err; - struct iamt_heci_device *device = (struct iamt_heci_device *) dev_id; + struct iamt_heci_device *dev = (struct iamt_heci_device *) dev_id; - device->host_hw_state = read_heci_register(device, H_CSR); + dev->host_hw_state = read_heci_register(dev, H_CSR); - if ((device->host_hw_state & H_IS) != H_IS) + if ((dev->host_hw_state & H_IS) != H_IS) return IRQ_NONE; /* disable interrupts */ - heci_csr_disable_interrupts(device); + heci_csr_disable_interrupts(dev); - /** + /* * Our device interrupted, schedule work the heci_bh_handler * to handle the interrupt processing. This needs to be a * workqueue item since the handler can sleep. */ - PREPARE_WORK(&device->work, heci_bh_handler); + PREPARE_WORK(&dev->work, heci_bh_handler); DBG("schedule work the heci_bh_handler.\n"); - err = schedule_work(&device->work); + err = schedule_work(&dev->work); if (!err) { printk(KERN_ERR "heci: schedule the heci_bh_handler" " failed error=%x\n", err); @@ -109,7 +109,7 @@ } /** - * _heci_cmpl: process completed operation. + * _heci_cmpl - process completed operation. * * @file_ext: private data of the file object. * @priv_cb_pos: callback block. @@ -138,7 +138,7 @@ } /** - * _heci_cmpl_iamthif: process completed iamthif operation. + * _heci_cmpl_iamthif - process completed iamthif operation. * * @dev: Device object for our driver. * @priv_cb_pos: callback block. @@ -303,7 +303,7 @@ * @dev: Device object for our driver * @slots: slots to read. * - * @return 0 on success, <0 on failure. + * returns 0 on success, <0 on failure. */ static int heci_bh_read_handler(struct io_heci_list *cmpl_list, struct iamt_heci_device *dev, @@ -525,7 +525,7 @@ * @dev: Device object for our driver * @heci_hdr: header of pthi message * - * @return 0 on success, <0 on failure. + * returns 0 on success, <0 on failure. */ static int heci_bh_read_pthi_message(struct io_heci_list *complete_list, struct iamt_heci_device *dev, @@ -583,7 +583,7 @@ * @file_ext: private data of the file object * @heci_hdr: header of heci client message * - * @return !=0 if matches, 0 if no match. + * returns !=0 if matches, 0 if no match. */ static int _heci_bh_state_ok(struct heci_file_private *file_ext, struct heci_msg_hdr *heci_hdr) @@ -602,7 +602,7 @@ * @dev: Device object for our driver * @heci_hdr: header of heci client message * - * @return 0 on success, <0 on failure. + * returns 0 on success, <0 on failure. */ static int heci_bh_read_client_message(struct io_heci_list *complete_list, struct iamt_heci_device *dev, @@ -684,12 +684,12 @@ } /** - * _heci_bh_iamthif_read: prepare to read iamthif data. + * _heci_bh_iamthif_read - prepare to read iamthif data. * * @dev: Device object for our driver. * @slots: free slots. * - * @return 0, OK; otherwise, error. + * returns 0, OK; otherwise, error. */ static int _heci_bh_iamthif_read(struct iamt_heci_device *dev, __s32 *slots) { @@ -716,7 +716,7 @@ } /** - * _heci_bh_close: process close related operation. + * _heci_bh_close - process close related operation. * * @dev: Device object for our driver. * @slots: free slots. @@ -724,7 +724,7 @@ * @file_ext: private data of the file object. * @cmpl_list: complete list. * - * @return 0, OK; otherwise, error. + * returns 0, OK; otherwise, error. */ static int _heci_bh_close(struct iamt_heci_device *dev, __s32 *slots, struct heci_cb_private *priv_cb_pos, @@ -759,7 +759,7 @@ } /** - * _heci_hb_close: process read related operation. + * _heci_hb_close - process read related operation. * * @dev: Device object for our driver. * @slots: free slots. @@ -767,7 +767,7 @@ * @file_ext: private data of the file object. * @cmpl_list: complete list. * - * @return 0, OK; otherwise, error. + * returns 0, OK; otherwise, error. */ static int _heci_bh_read(struct iamt_heci_device *dev, __s32 *slots, struct heci_cb_private *priv_cb_pos, @@ -799,7 +799,7 @@ /** - * _heci_bh_ioctl: process ioctl related operation. + * _heci_bh_ioctl - process ioctl related operation. * * @dev: Device object for our driver. * @slots: free slots. @@ -807,7 +807,7 @@ * @file_ext: private data of the file object. * @cmpl_list: complete list. * - * @return 0, OK; otherwise, error. + * returns 0, OK; otherwise, error. */ static int _heci_bh_ioctl(struct iamt_heci_device *dev, __s32 *slots, struct heci_cb_private *priv_cb_pos, @@ -839,7 +839,7 @@ } /** - * _heci_bh_cmpl: process completed and no-iamthif operation. + * _heci_bh_cmpl - process completed and no-iamthif operation. * * @dev: Device object for our driver. * @slots: free slots. @@ -847,7 +847,7 @@ * @file_ext: private data of the file object. * @cmpl_list: complete list. * - * @return 0, OK; otherwise, error. + * returns 0, OK; otherwise, error. */ static int _heci_bh_cmpl(struct iamt_heci_device *dev, __s32 *slots, struct heci_cb_private *priv_cb_pos, @@ -932,7 +932,7 @@ } /** - * _heci_bh_cmpl_iamthif: process completed iamthif operation. + * _heci_bh_cmpl_iamthif - process completed iamthif operation. * * @dev: Device object for our driver. * @slots: free slots. @@ -940,7 +940,7 @@ * @file_ext: private data of the file object. * @cmpl_list: complete list. * - * @return 0, OK; otherwise, error. + * returns 0, OK; otherwise, error. */ static int _heci_bh_cmpl_iamthif(struct iamt_heci_device *dev, __s32 *slots, struct heci_cb_private *priv_cb_pos, @@ -1022,7 +1022,7 @@ * @dev: Device object for our driver * @slots: slots to write. * - * @return 0 on success, <0 on failure. + * returns 0 on success, <0 on failure. */ static int heci_bh_write_handler(struct io_heci_list *cmpl_list, struct iamt_heci_device *dev, @@ -1225,7 +1225,7 @@ * @rs: connect response bus message * @dev: Device object for our driver * - * @return 0 on success, <0 on failure. + * returns 0 on success, <0 on failure. */ static int is_treat_specially_client(struct heci_file_private *file_ext, struct hbm_client_connect_response *rs) @@ -1338,7 +1338,7 @@ * @file: private data of the file object. * @flow: flow control. * - * @return !=0, same; 0,not. + * returns !=0, same; 0,not. */ static int same_flow_addr(struct heci_file_private *file, struct hbm_flow_control *flow) @@ -1375,6 +1375,7 @@ } } } + /** * heci_client_flow_control_response - flow control response bh routine * @@ -1421,7 +1422,7 @@ * @file: private data of the file object. * @disconn: disconnection request. * - * @return !=0, same; 0,not. + * returns !=0, same; 0,not. */ static int same_disconn_addr(struct heci_file_private *file, struct hbm_client_disconnect_request *disconn) @@ -1504,7 +1505,7 @@ spin_unlock_bh(&dev->device_lock); return; } - /*** Watchdog ***/ + /* Watchdog */ if ((dev->wd_due_counter != 0) && (dev->wd_bypass == 0)) { if (--dev->wd_due_counter == 0) { if (dev->host_buffer_is_empty && Modified: heci/trunk/src/io_heci.c =================================================================== --- heci/trunk/src/io_heci.c 2008-07-17 18:31:29 UTC (rev 200) +++ heci/trunk/src/io_heci.c 2008-07-18 19:50:55 UTC (rev 201) @@ -74,14 +74,13 @@ * @k_msg: data in kernel on the stack * @file_ext: private data of the file object * - * @return 0 on success, <0 on failure. + * returns 0 on success, <0 on failure. */ int heci_ioctl_get_version(struct iamt_heci_device *dev, int if_num, struct heci_message_data *u_msg, struct heci_message_data k_msg, struct heci_file_private *file_ext) { - int rets = 0; struct heci_driver_version *version; struct heci_message_data res_msg; @@ -135,14 +134,13 @@ * @k_msg: data in kernel on the stack * @file_ext: private data of the file object * - * @return 0 on success, <0 on failure. + * returns 0 on success, <0 on failure. */ int heci_ioctl_connect_client(struct iamt_heci_device *dev, int if_num, struct heci_message_data *u_msg, struct heci_message_data k_msg, struct file *file) { - int rets = 0; struct heci_message_data req_msg, res_msg; struct heci_cb_private *priv_cb = NULL; @@ -366,7 +364,7 @@ * @k_msg: data in kernel on the stack * @file_ext: private data of the file object * - * @return 0 on success, <0 on failure. + * returns 0 on success, <0 on failure. */ int heci_ioctl_wd(struct iamt_heci_device *dev, int if_num, struct heci_message_data k_msg, @@ -426,10 +424,10 @@ dev->wd_pending = 0; dev->wd_due_counter = 1; /* next timer */ if (dev->wd_timeout == 0) { - memcpy(dev->wd_data, &stop_wd_params, + memcpy(dev->wd_data, &heci_stop_wd_params, HECI_WD_PARAMS_SIZE); } else { - memcpy(dev->wd_data, &start_wd_params, + memcpy(dev->wd_data, &heci_start_wd_params, HECI_WD_PARAMS_SIZE); mod_timer(&dev->wd_timer, jiffies); } @@ -448,7 +446,7 @@ * @k_msg: data in kernel on the stack * @file_ext: private data of the file object * - * @return 0 on success, <0 on failure. + * returns 0 on success, <0 on failure. */ int heci_ioctl_bypass_wd(struct iamt_heci_device *dev, int if_num, struct heci_message_data k_msg, @@ -486,7 +484,7 @@ * @dev: Device object for our driver * @file: pointer to file object * - * @return returned a list entry on success, NULL on failure. + * returns returned a list entry on success, NULL on failure. */ struct heci_cb_private *find_pthi_read_list_entry( struct iamt_heci_device *dev, @@ -521,7 +519,7 @@ * @length: data length to read * @offset: data read offset * - * @return + * returns * returned data length on success, * zero if no data to read, * negative on failure. @@ -529,7 +527,6 @@ int pthi_read(struct iamt_heci_device *dev, int if_num, struct file *file, char *ubuf, size_t length, loff_t *offset) { - int rets = 0; struct heci_cb_private *priv_cb = NULL; struct heci_file_private *file_ext = file->private_data; @@ -622,7 +619,7 @@ * @if_num: minor number * @file_ext: private data of the file object * - * @return 0 on success, <0 on failure. + * returns 0 on success, <0 on failure. */ int heci_start_read(struct iamt_heci_device *dev, int if_num, struct heci_file_private *file_ext) @@ -707,12 +704,12 @@ } /** - * pthi_write: write iamthif data to pthi client + * pthi_write - write iamthif data to pthi client * * @dev: Device object for our driver * @priv_cb: heci call back struct * - * @return 0 on success, <0 on failure. + * returns 0 on success, <0 on failure. */ int pthi_write(struct iamt_heci_device *dev, struct heci_cb_private *priv_cb) @@ -790,7 +787,7 @@ * * @dev: Device object for our driver * - * @return 0 on success, <0 on failure. + * returns 0 on success, <0 on failure. */ void run_next_iamthif_cmd(struct iamt_heci_device *dev) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |