diff -r 3213cbbd58b7 -r 6965c23a6826 drivers/ec_module.c --- a/drivers/ec_module.c Fri Dec 16 16:21:22 2005 +0000 +++ b/drivers/ec_module.c Mon Dec 19 08:13:11 2005 +0000 @@ -16,7 +16,7 @@ * Fax.: +49 201/61 98 36 * E-mail: sp@igh-essen.com * - ******************************************************************************/ + *****************************************************************************/ #include #include @@ -24,30 +24,32 @@ #include "ec_module.h" -/******************************************************************************/ - -#define LITERAL(X) #X -#define STRINGIFY(X) LITERAL(X) - -#define COMPILE_INFO "Revision " STRINGIFY(EC_REV) \ - ", compiled by " STRINGIFY(EC_USER) \ - " at " STRINGIFY(EC_DATE) - -/******************************************************************************/ +/*****************************************************************************/ + +#define LIT(X) #X +#define STR(X) LIT(X) + +#define COMPILE_INFO "Revision " STR(EC_REV) \ + ", compiled by " STR(EC_USER) \ + " at " STR(EC_DATE) + +/*****************************************************************************/ int ecat_master_count = 1; EtherCAT_master_t *ecat_masters = NULL; int *ecat_masters_reserved = NULL; -/******************************************************************************/ - -MODULE_AUTHOR ("Wilhelm Hagemeister , Florian Pose "); +/*****************************************************************************/ + +MODULE_AUTHOR ("Wilhelm Hagemeister ," + "Florian Pose "); MODULE_DESCRIPTION ("EtherCAT master driver module"); MODULE_LICENSE("GPL"); MODULE_VERSION(COMPILE_INFO); module_param(ecat_master_count, int, 1); -MODULE_PARM_DESC(ecat_master_count, "Number of EtherCAT master to initialize."); +MODULE_PARM_DESC(ecat_master_count, + "Number of EtherCAT master to initialize."); module_init(ecat_init_module); module_exit(ecat_cleanup_module); @@ -57,7 +59,7 @@ EXPORT_SYMBOL(EtherCAT_request); EXPORT_SYMBOL(EtherCAT_release); -/******************************************************************************/ +/*****************************************************************************/ /** Init-Funktion des EtherCAT-Master-Treibermodules @@ -75,28 +77,29 @@ printk(KERN_ERR "EtherCAT: Master driver, %s\n", COMPILE_INFO); - if (ecat_master_count < 1) - { - printk(KERN_ERR "EtherCAT: Error - Illegal ecat_master_count: %i\n", - ecat_master_count); + if (ecat_master_count < 1) { + printk(KERN_ERR "EtherCAT: Error - Illegal" + " ecat_master_count: %i\n", ecat_master_count); return -1; } printk(KERN_ERR "EtherCAT: Initializing %i EtherCAT master(s)...\n", ecat_master_count); - if ((ecat_masters = (EtherCAT_master_t *) kmalloc(sizeof(EtherCAT_master_t) - * ecat_master_count, - GFP_KERNEL)) == NULL) - { - printk(KERN_ERR "EtherCAT: Could not allocate memory for EtherCAT master(s)!\n"); - return -1; - } - - if ((ecat_masters_reserved = (int *) kmalloc(sizeof(int) * ecat_master_count, - GFP_KERNEL)) == NULL) - { - printk(KERN_ERR "EtherCAT: Could not allocate memory for reservation flags!\n"); + if ((ecat_masters = + (EtherCAT_master_t *) kmalloc(sizeof(EtherCAT_master_t) + * ecat_master_count, + GFP_KERNEL)) == NULL) { + printk(KERN_ERR "EtherCAT: Could not allocate" + " memory for EtherCAT master(s)!\n"); + return -1; + } + + if ((ecat_masters_reserved = + (int *) kmalloc(sizeof(int) * ecat_master_count, + GFP_KERNEL)) == NULL) { + printk(KERN_ERR "EtherCAT: Could not allocate" + " memory for reservation flags!\n"); kfree(ecat_masters); return -1; } @@ -112,7 +115,7 @@ return 0; } -/******************************************************************************/ +/*****************************************************************************/ /** Cleanup-Funktion des EtherCAT-Master-Treibermoduls @@ -131,7 +134,8 @@ for (i = 0; i < ecat_master_count; i++) { if (ecat_masters_reserved[i]) { - printk(KERN_WARNING "EtherCAT: Warning - Master %i is still in use!\n", i); + printk(KERN_WARNING "EtherCAT: Warning -" + " Master %i is still in use!\n", i); } EtherCAT_master_clear(&ecat_masters[i]); @@ -143,7 +147,7 @@ printk(KERN_ERR "EtherCAT: Master driver cleaned up.\n"); } -/***************************************************************/ +/*****************************************************************************/ /** Setzt das EtherCAT-Geraet, auf dem der Master arbeitet. @@ -159,8 +163,7 @@ int EtherCAT_register_device(int index, EtherCAT_device_t *device) { - if (index < 0 || index >= ecat_master_count) - { + if (index < 0 || index >= ecat_master_count) { printk(KERN_ERR "EtherCAT: Master %i does not exist!\n", index); return -1; } @@ -168,7 +171,7 @@ return EtherCAT_master_open(&ecat_masters[index], device); } -/***************************************************************/ +/*****************************************************************************/ /** Loescht das EtherCAT-Geraet, auf dem der Master arbeitet. @@ -179,8 +182,7 @@ void EtherCAT_unregister_device(int index, EtherCAT_device_t *device) { - if (index < 0 || index >= ecat_master_count) - { + if (index < 0 || index >= ecat_master_count) { printk(KERN_WARNING "EtherCAT: Master %i does not exist!\n", index); return; } @@ -188,7 +190,7 @@ EtherCAT_master_close(&ecat_masters[index], device); } -/******************************************************************************/ +/*****************************************************************************/ /** Reserviert einen bestimmten EtherCAT-Master und das zugehörige Gerät. @@ -212,7 +214,8 @@ } if (!ecat_masters[index].dev) { - printk(KERN_ERR "EtherCAT: Master %i has no device assigned yet!\n", index); + printk(KERN_ERR "EtherCAT: Master %i has no device assigned yet!\n", + index); return NULL; } @@ -233,7 +236,7 @@ return &ecat_masters[index]; } -/******************************************************************************/ +/*****************************************************************************/ /** Gibt einen zuvor reservierten EtherCAT-Master wieder frei. @@ -268,4 +271,4 @@ (unsigned int) master); } -/******************************************************************************/ +/*****************************************************************************/