aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2011-08-21 18:56:46 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-09-03 19:57:09 -0400
commit7de3461c93a6d65355113cca333723eb8a1a0225 (patch)
tree73dcf3d77ea52fa0996a0716a36cd58a415f0fbe
parent86b0dbef777a1fbb9922e304f047921d4e9d9c40 (diff)
[media] ene_ir: Use current logging styles
Add pr_fmt. Convert ene_warn and ene_notice to pr_<level>. Use pr_debug in __dbg macro and a little neatening. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/rc/ene_ir.c73
-rw-r--r--drivers/media/rc/ene_ir.h19
2 files changed, 42 insertions, 50 deletions
diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c
index 2b9c2569d74a..cf10ecf5acec 100644
--- a/drivers/media/rc/ene_ir.c
+++ b/drivers/media/rc/ene_ir.c
@@ -30,6 +30,8 @@
30 * 30 *
31 */ 31 */
32 32
33#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
34
33#include <linux/kernel.h> 35#include <linux/kernel.h>
34#include <linux/module.h> 36#include <linux/module.h>
35#include <linux/pnp.h> 37#include <linux/pnp.h>
@@ -118,31 +120,31 @@ static int ene_hw_detect(struct ene_device *dev)
118 dev->pll_freq == ENE_DEFAULT_PLL_FREQ ? 2 : 4; 120 dev->pll_freq == ENE_DEFAULT_PLL_FREQ ? 2 : 4;
119 121
120 if (hw_revision == 0xFF) { 122 if (hw_revision == 0xFF) {
121 ene_warn("device seems to be disabled"); 123 pr_warn("device seems to be disabled\n");
122 ene_warn("send a mail to lirc-list@lists.sourceforge.net"); 124 pr_warn("send a mail to lirc-list@lists.sourceforge.net\n");
123 ene_warn("please attach output of acpidump and dmidecode"); 125 pr_warn("please attach output of acpidump and dmidecode\n");
124 return -ENODEV; 126 return -ENODEV;
125 } 127 }
126 128
127 ene_notice("chip is 0x%02x%02x - kbver = 0x%02x, rev = 0x%02x", 129 pr_notice("chip is 0x%02x%02x - kbver = 0x%02x, rev = 0x%02x\n",
128 chip_major, chip_minor, old_ver, hw_revision); 130 chip_major, chip_minor, old_ver, hw_revision);
129 131
130 ene_notice("PLL freq = %d", dev->pll_freq); 132 pr_notice("PLL freq = %d\n", dev->pll_freq);
131 133
132 if (chip_major == 0x33) { 134 if (chip_major == 0x33) {
133 ene_warn("chips 0x33xx aren't supported"); 135 pr_warn("chips 0x33xx aren't supported\n");
134 return -ENODEV; 136 return -ENODEV;
135 } 137 }
136 138
137 if (chip_major == 0x39 && chip_minor == 0x26 && hw_revision == 0xC0) { 139 if (chip_major == 0x39 && chip_minor == 0x26 && hw_revision == 0xC0) {
138 dev->hw_revision = ENE_HW_C; 140 dev->hw_revision = ENE_HW_C;
139 ene_notice("KB3926C detected"); 141 pr_notice("KB3926C detected\n");
140 } else if (old_ver == 0x24 && hw_revision == 0xC0) { 142 } else if (old_ver == 0x24 && hw_revision == 0xC0) {
141 dev->hw_revision = ENE_HW_B; 143 dev->hw_revision = ENE_HW_B;
142 ene_notice("KB3926B detected"); 144 pr_notice("KB3926B detected\n");
143 } else { 145 } else {
144 dev->hw_revision = ENE_HW_D; 146 dev->hw_revision = ENE_HW_D;
145 ene_notice("KB3926D or higher detected"); 147 pr_notice("KB3926D or higher detected\n");
146 } 148 }
147 149
148 /* detect features hardware supports */ 150 /* detect features hardware supports */
@@ -152,7 +154,7 @@ static int ene_hw_detect(struct ene_device *dev)
152 fw_reg1 = ene_read_reg(dev, ENE_FW1); 154 fw_reg1 = ene_read_reg(dev, ENE_FW1);
153 fw_reg2 = ene_read_reg(dev, ENE_FW2); 155 fw_reg2 = ene_read_reg(dev, ENE_FW2);
154 156
155 ene_notice("Firmware regs: %02x %02x", fw_reg1, fw_reg2); 157 pr_notice("Firmware regs: %02x %02x\n", fw_reg1, fw_reg2);
156 158
157 dev->hw_use_gpio_0a = !!(fw_reg2 & ENE_FW2_GP0A); 159 dev->hw_use_gpio_0a = !!(fw_reg2 & ENE_FW2_GP0A);
158 dev->hw_learning_and_tx_capable = !!(fw_reg2 & ENE_FW2_LEARNING); 160 dev->hw_learning_and_tx_capable = !!(fw_reg2 & ENE_FW2_LEARNING);
@@ -161,30 +163,29 @@ static int ene_hw_detect(struct ene_device *dev)
161 if (dev->hw_learning_and_tx_capable) 163 if (dev->hw_learning_and_tx_capable)
162 dev->hw_fan_input = !!(fw_reg2 & ENE_FW2_FAN_INPUT); 164 dev->hw_fan_input = !!(fw_reg2 & ENE_FW2_FAN_INPUT);
163 165
164 ene_notice("Hardware features:"); 166 pr_notice("Hardware features:\n");
165 167
166 if (dev->hw_learning_and_tx_capable) { 168 if (dev->hw_learning_and_tx_capable) {
167 ene_notice("* Supports transmitting & learning mode"); 169 pr_notice("* Supports transmitting & learning mode\n");
168 ene_notice(" This feature is rare and therefore,"); 170 pr_notice(" This feature is rare and therefore,\n");
169 ene_notice(" you are welcome to test it,"); 171 pr_notice(" you are welcome to test it,\n");
170 ene_notice(" and/or contact the author via:"); 172 pr_notice(" and/or contact the author via:\n");
171 ene_notice(" lirc-list@lists.sourceforge.net"); 173 pr_notice(" lirc-list@lists.sourceforge.net\n");
172 ene_notice(" or maximlevitsky@gmail.com"); 174 pr_notice(" or maximlevitsky@gmail.com\n");
173 175
174 ene_notice("* Uses GPIO %s for IR raw input", 176 pr_notice("* Uses GPIO %s for IR raw input\n",
175 dev->hw_use_gpio_0a ? "40" : "0A"); 177 dev->hw_use_gpio_0a ? "40" : "0A");
176 178
177 if (dev->hw_fan_input) 179 if (dev->hw_fan_input)
178 ene_notice("* Uses unused fan feedback input as source" 180 pr_notice("* Uses unused fan feedback input as source of demodulated IR data\n");
179 " of demodulated IR data");
180 } 181 }
181 182
182 if (!dev->hw_fan_input) 183 if (!dev->hw_fan_input)
183 ene_notice("* Uses GPIO %s for IR demodulated input", 184 pr_notice("* Uses GPIO %s for IR demodulated input\n",
184 dev->hw_use_gpio_0a ? "0A" : "40"); 185 dev->hw_use_gpio_0a ? "0A" : "40");
185 186
186 if (dev->hw_extra_buffer) 187 if (dev->hw_extra_buffer)
187 ene_notice("* Uses new style input buffer"); 188 pr_notice("* Uses new style input buffer\n");
188 return 0; 189 return 0;
189} 190}
190 191
@@ -215,13 +216,13 @@ static void ene_rx_setup_hw_buffer(struct ene_device *dev)
215 216
216 dev->buffer_len = dev->extra_buf1_len + dev->extra_buf2_len + 8; 217 dev->buffer_len = dev->extra_buf1_len + dev->extra_buf2_len + 8;
217 218
218 ene_notice("Hardware uses 2 extended buffers:"); 219 pr_notice("Hardware uses 2 extended buffers:\n");
219 ene_notice(" 0x%04x - len : %d", dev->extra_buf1_address, 220 pr_notice(" 0x%04x - len : %d\n",
220 dev->extra_buf1_len); 221 dev->extra_buf1_address, dev->extra_buf1_len);
221 ene_notice(" 0x%04x - len : %d", dev->extra_buf2_address, 222 pr_notice(" 0x%04x - len : %d\n",
222 dev->extra_buf2_len); 223 dev->extra_buf2_address, dev->extra_buf2_len);
223 224
224 ene_notice("Total buffer len = %d", dev->buffer_len); 225 pr_notice("Total buffer len = %d\n", dev->buffer_len);
225 226
226 if (dev->buffer_len > 64 || dev->buffer_len < 16) 227 if (dev->buffer_len > 64 || dev->buffer_len < 16)
227 goto error; 228 goto error;
@@ -240,7 +241,7 @@ static void ene_rx_setup_hw_buffer(struct ene_device *dev)
240 ene_set_reg_mask(dev, ENE_FW1, ENE_FW1_EXTRA_BUF_HND); 241 ene_set_reg_mask(dev, ENE_FW1, ENE_FW1_EXTRA_BUF_HND);
241 return; 242 return;
242error: 243error:
243 ene_warn("Error validating extra buffers, device probably won't work"); 244 pr_warn("Error validating extra buffers, device probably won't work\n");
244 dev->hw_extra_buffer = false; 245 dev->hw_extra_buffer = false;
245 ene_clear_reg_mask(dev, ENE_FW1, ENE_FW1_EXTRA_BUF_HND); 246 ene_clear_reg_mask(dev, ENE_FW1, ENE_FW1_EXTRA_BUF_HND);
246} 247}
@@ -588,7 +589,7 @@ static void ene_tx_enable(struct ene_device *dev)
588 dbg("TX: Transmitter #2 is connected"); 589 dbg("TX: Transmitter #2 is connected");
589 590
590 if (!(fwreg2 & (ENE_FW2_EMMITER1_CONN | ENE_FW2_EMMITER2_CONN))) 591 if (!(fwreg2 & (ENE_FW2_EMMITER1_CONN | ENE_FW2_EMMITER2_CONN)))
591 ene_warn("TX: transmitter cable isn't connected!"); 592 pr_warn("TX: transmitter cable isn't connected!\n");
592 593
593 /* disable receive on revc */ 594 /* disable receive on revc */
594 if (dev->hw_revision == ENE_HW_C) 595 if (dev->hw_revision == ENE_HW_C)
@@ -615,7 +616,7 @@ static void ene_tx_sample(struct ene_device *dev)
615 bool pulse = dev->tx_sample_pulse; 616 bool pulse = dev->tx_sample_pulse;
616 617
617 if (!dev->tx_buffer) { 618 if (!dev->tx_buffer) {
618 ene_warn("TX: BUG: attempt to transmit NULL buffer"); 619 pr_warn("TX: BUG: attempt to transmit NULL buffer\n");
619 return; 620 return;
620 } 621 }
621 622
@@ -1049,7 +1050,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
1049 dev->hw_learning_and_tx_capable = true; 1050 dev->hw_learning_and_tx_capable = true;
1050 setup_timer(&dev->tx_sim_timer, ene_tx_irqsim, 1051 setup_timer(&dev->tx_sim_timer, ene_tx_irqsim,
1051 (long unsigned int)dev); 1052 (long unsigned int)dev);
1052 ene_warn("Simulation of TX activated"); 1053 pr_warn("Simulation of TX activated\n");
1053 } 1054 }
1054 1055
1055 if (!dev->hw_learning_and_tx_capable) 1056 if (!dev->hw_learning_and_tx_capable)
@@ -1089,7 +1090,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
1089 if (error < 0) 1090 if (error < 0)
1090 goto error; 1091 goto error;
1091 1092
1092 ene_notice("driver has been successfully loaded"); 1093 pr_notice("driver has been successfully loaded\n");
1093 return 0; 1094 return 0;
1094error: 1095error:
1095 if (dev && dev->irq >= 0) 1096 if (dev && dev->irq >= 0)
diff --git a/drivers/media/rc/ene_ir.h b/drivers/media/rc/ene_ir.h
index 017c209cdf8a..fd108d90f750 100644
--- a/drivers/media/rc/ene_ir.h
+++ b/drivers/media/rc/ene_ir.h
@@ -182,20 +182,11 @@
182#define ENE_HW_C 2 /* 3926C */ 182#define ENE_HW_C 2 /* 3926C */
183#define ENE_HW_D 3 /* 3926D or later */ 183#define ENE_HW_D 3 /* 3926D or later */
184 184
185#define ene_printk(level, text, ...) \ 185#define __dbg(level, format, ...) \
186 printk(level ENE_DRIVER_NAME ": " text "\n", ## __VA_ARGS__) 186do { \
187 187 if (debug >= level) \
188#define ene_notice(text, ...) ene_printk(KERN_NOTICE, text, ## __VA_ARGS__) 188 pr_debug(format "\n", ## __VA_ARGS__); \
189#define ene_warn(text, ...) ene_printk(KERN_WARNING, text, ## __VA_ARGS__) 189} while (0)
190
191
192#define __dbg(level, format, ...) \
193 do { \
194 if (debug >= level) \
195 printk(KERN_DEBUG ENE_DRIVER_NAME \
196 ": " format "\n", ## __VA_ARGS__); \
197 } while (0)
198
199 190
200#define dbg(format, ...) __dbg(1, format, ## __VA_ARGS__) 191#define dbg(format, ...) __dbg(1, format, ## __VA_ARGS__)
201#define dbg_verbose(format, ...) __dbg(2, format, ## __VA_ARGS__) 192#define dbg_verbose(format, ...) __dbg(2, format, ## __VA_ARGS__)