From 419eeeb2afdaa839ab3101c9d6d61b7eb7c1ff4b Mon Sep 17 00:00:00 2001 From: Miroslav Ondra Date: Wed, 5 Sep 2018 11:36:30 +0200 Subject: [PATCH] format cdev debug messages clean old code --- modules/unipi/src/unipi_spi.c | 21 ++++--- modules/unipi/src/unipi_spi.h | 100 ---------------------------------- 2 files changed, 10 insertions(+), 111 deletions(-) diff --git a/modules/unipi/src/unipi_spi.c b/modules/unipi/src/unipi_spi.c index 4eded51..65a6c97 100644 --- a/modules/unipi/src/unipi_spi.c +++ b/modules/unipi/src/unipi_spi.c @@ -1142,33 +1142,33 @@ s32 char_register_driver(void) s32 ret = 0; // Character device registration - unipi_spi_trace(KERN_DEBUG "UNIPISPI: Initialising Character Device\n"); + unipi_spi_trace(KERN_DEBUG "UNIPISPI: CDEV Initialising Character Device\n"); neuronspi_cdrv.major_number = register_chrdev(0, NEURON_DEVICE_NAME, &file_ops); if (neuronspi_cdrv.major_number < 0){ - printk(KERN_ALERT "NEURONSPI: failed to register a major number\n"); + printk(KERN_ALERT "NEURONSPI: CDEV Failed to register chrdev\n"); return neuronspi_cdrv.major_number; } - unipi_spi_trace(KERN_DEBUG "UNIPISPI: registered correctly with major number %d\n", neuronspi_cdrv.major_number); + unipi_spi_trace(KERN_DEBUG "UNIPISPI: CDEV major number %d\n", neuronspi_cdrv.major_number); // Character class registration neuronspi_cdrv.driver_class = class_create(THIS_MODULE, NEURON_DEVICE_CLASS); if (IS_ERR(neuronspi_cdrv.driver_class)) { unregister_chrdev(neuronspi_cdrv.major_number, NEURON_DEVICE_NAME); - printk(KERN_ALERT "NEURONSPI: Failed to register device class\n"); + printk(KERN_ALERT "NEURONSPI: CDEV Failed to register device class\n"); return PTR_ERR(neuronspi_cdrv.driver_class); } - unipi_spi_trace(KERN_DEBUG "UNIPISPI: device class registered correctly\n"); + unipi_spi_trace(KERN_DEBUG "UNIPISPI: CDEV Device class registered\n"); // Device driver registration neuronspi_cdrv.dev = device_create_with_groups(neuronspi_cdrv.driver_class, &(neuron_plc_dev->dev), MKDEV(neuronspi_cdrv.major_number, 0), NULL, neuron_plc_attr_groups, NEURON_DEVICE_NAME); if (IS_ERR(neuronspi_cdrv.dev)) { class_destroy(neuronspi_cdrv.driver_class); unregister_chrdev(neuronspi_cdrv.major_number, NEURON_DEVICE_NAME); - printk(KERN_ALERT "NEURONSPI: Failed to create the device\n"); + printk(KERN_ALERT "NEURONSPI: CDEV Failed to create the device\n"); return PTR_ERR(neuronspi_cdrv.dev); } - unipi_spi_trace(KERN_DEBUG "UNIPISPI: device class created correctly\n"); + unipi_spi_trace(KERN_DEBUG "UNIPISPI: CDEV Device class created\n"); return ret; } @@ -1179,7 +1179,7 @@ s32 char_unregister_driver(void) class_unregister(neuronspi_cdrv.driver_class); // Unregister the class class_destroy(neuronspi_cdrv.driver_class); // Destroy the class unregister_chrdev(neuronspi_cdrv.major_number, NEURON_DEVICE_NAME); // Unregister the major number - printk(KERN_INFO "UNIPISPI: Device unloaded successfully\n"); + printk(KERN_INFO "UNIPISPI: CDEV unloaded\n"); return 0; } @@ -1216,11 +1216,10 @@ static s32 __init neuronspi_init(void) ret = spi_register_driver(&neuronspi_spi_driver); if (ret < 0) { - printk(KERN_ERR "UNIPISPI: Failed to init neuronspi spi --> %d\n", ret); + printk(KERN_ERR "UNIPISPI: Failed to init spi driver --> %d\n", ret); return ret; - } else { - printk(KERN_INFO "UNIPISPI: SPI Driver Registered, Major Version: %s\n", NEURONSPI_MAJOR_VERSIONSTRING); } + printk(KERN_INFO "UNIPISPI: SPI Driver Registered, Major Version: %s\n", NEURONSPI_MAJOR_VERSIONSTRING); neuronspi_invalidate_thread = kthread_create(neuronspi_regmap_invalidate, NULL, "unipispi_inv"); if (neuronspi_invalidate_thread != NULL) { diff --git a/modules/unipi/src/unipi_spi.h b/modules/unipi/src/unipi_spi.h index b3f24d2..ba8e964 100644 --- a/modules/unipi/src/unipi_spi.h +++ b/modules/unipi/src/unipi_spi.h @@ -165,107 +165,7 @@ static const struct regmap_config neuronspi_regmap_config_default = .can_multi_write = 1, }; -/* -static const struct iio_chan_spec neuronspi_stm_ai_chan_spec[] = { - { - .type = IIO_VOLTAGE, - .indexed = 1, - .channel = 0, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), - .output = 0 - }, - { - .type = IIO_CURRENT, - .indexed = 1, - .channel = 1, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), - .output = 0 - } -}; - -static const struct iio_chan_spec neuronspi_stm_ao_chan_spec[] = { - { - .type = IIO_VOLTAGE, - .indexed = 1, - .channel = 0, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), - .output = 1 - }, - { - .type = IIO_CURRENT, - .indexed = 1, - .channel = 1, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), - .output = 1 - }, - { - .type = IIO_RESISTANCE, - .indexed = 1, - .channel = 2, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), - .output = 0 - } -}; - -static const struct iio_chan_spec neuronspi_sec_ai_chan_spec[] = { - { - .type = IIO_VOLTAGE, - .indexed = 1, - .channel = 0, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), - .output = 0 - }, - { - .type = IIO_CURRENT, - .indexed = 1, - .channel = 1, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), - .output = 0 - }, - { - .type = IIO_RESISTANCE, - .indexed = 1, - .channel = 2, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), - .output = 0 - } -}; - -static const struct iio_chan_spec neuronspi_sec_ao_chan_spec[] = { - { - .type = IIO_VOLTAGE, - .indexed = 1, - .channel = 0, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), - .output = 1 - } -}; -static const struct iio_info neuronspi_stm_ai_info = { - .read_raw = neuronspi_iio_stm_ai_read_raw, - .driver_module = THIS_MODULE, - .attrs = &neuron_stm_ai_group, -}; - -static const struct iio_info neuronspi_stm_ao_info = { - .read_raw = neuronspi_iio_stm_ao_read_raw, - .write_raw = neuronspi_iio_stm_ao_write_raw, - .driver_module = THIS_MODULE, - .attrs = &neuron_stm_ao_group, -}; - -static const struct iio_info neuronspi_sec_ai_info = { - .read_raw = neuronspi_iio_sec_ai_read_raw, - .driver_module = THIS_MODULE, - .attrs = &neuron_sec_ai_group, -}; - -static const struct iio_info neuronspi_sec_ao_info = { - .write_raw = neuronspi_iio_sec_ao_write_raw, - .driver_module = THIS_MODULE, - //.attrs = &neuron_sec_ao_group, -}; -*/ // These defines need to be at the end #define to_neuronspi_uart_data(p,e) ((container_of((p), struct neuronspi_uart_data, e))) #define to_neuronspi_port(p,e) ((container_of((p), struct neuronspi_port, e))) -- 2.34.1