aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nfc
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2013-04-05 15:27:39 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2013-09-24 19:35:39 -0400
commit17936b43f0fdede23582d83a45622751409c99b9 (patch)
tree8ebdbac110d202dc4131165b00d5fd87a5233edc /drivers/nfc
parent073a625f0b80fb7613220a56375b0f3d2831af1b (diff)
NFC: Standardize logging style
Use standardized styles to minimize coding defects. Always use nfc_<level> where feasible. Add \n to formats where appropriate. Typo "it it" correction. Add #define pr_fmt where appropriate. Remove function tracing logging messages. Remove OOM messages. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc')
-rw-r--r--drivers/nfc/mei_phy.c6
-rw-r--r--drivers/nfc/microread/i2c.c32
-rw-r--r--drivers/nfc/microread/mei.c4
-rw-r--r--drivers/nfc/microread/microread.c7
-rw-r--r--drivers/nfc/nfcwilink.c2
-rw-r--r--drivers/nfc/pn533.c5
-rw-r--r--drivers/nfc/pn544/i2c.c42
-rw-r--r--drivers/nfc/pn544/pn544.c13
8 files changed, 50 insertions, 61 deletions
diff --git a/drivers/nfc/mei_phy.c b/drivers/nfc/mei_phy.c
index 606bf55e76ec..85f90090cc1d 100644
--- a/drivers/nfc/mei_phy.c
+++ b/drivers/nfc/mei_phy.c
@@ -18,6 +18,8 @@
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */ 19 */
20 20
21#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
22
21#include <linux/module.h> 23#include <linux/module.h>
22#include <linux/slab.h> 24#include <linux/slab.h>
23#include <linux/nfc.h> 25#include <linux/nfc.h>
@@ -60,13 +62,13 @@ int nfc_mei_phy_enable(void *phy_id)
60 62
61 r = mei_cl_enable_device(phy->device); 63 r = mei_cl_enable_device(phy->device);
62 if (r < 0) { 64 if (r < 0) {
63 pr_err("MEI_PHY: Could not enable device\n"); 65 pr_err("Could not enable device\n");
64 return r; 66 return r;
65 } 67 }
66 68
67 r = mei_cl_register_event_cb(phy->device, nfc_mei_event_cb, phy); 69 r = mei_cl_register_event_cb(phy->device, nfc_mei_event_cb, phy);
68 if (r) { 70 if (r) {
69 pr_err("MEY_PHY: Event cb registration failed\n"); 71 pr_err("Event cb registration failed\n");
70 mei_cl_disable_device(phy->device); 72 mei_cl_disable_device(phy->device);
71 phy->powered = 0; 73 phy->powered = 0;
72 74
diff --git a/drivers/nfc/microread/i2c.c b/drivers/nfc/microread/i2c.c
index 101089495bf8..696e3467eccc 100644
--- a/drivers/nfc/microread/i2c.c
+++ b/drivers/nfc/microread/i2c.c
@@ -18,6 +18,8 @@
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */ 19 */
20 20
21#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
22
21#include <linux/module.h> 23#include <linux/module.h>
22#include <linux/i2c.h> 24#include <linux/i2c.h>
23#include <linux/delay.h> 25#include <linux/delay.h>
@@ -95,12 +97,8 @@ static int check_crc(struct sk_buff *skb)
95 crc = crc ^ skb->data[i]; 97 crc = crc ^ skb->data[i];
96 98
97 if (crc != skb->data[skb->len-1]) { 99 if (crc != skb->data[skb->len-1]) {
98 pr_err(MICROREAD_I2C_DRIVER_NAME 100 pr_err("CRC error 0x%x != 0x%x\n", crc, skb->data[skb->len-1]);
99 ": CRC error 0x%x != 0x%x\n", 101 pr_info("%s: BAD CRC\n", __func__);
100 crc, skb->data[skb->len-1]);
101
102 pr_info(DRIVER_DESC ": %s : BAD CRC\n", __func__);
103
104 return -EPERM; 102 return -EPERM;
105 } 103 }
106 104
@@ -160,18 +158,15 @@ static int microread_i2c_read(struct microread_i2c_phy *phy,
160 u8 tmp[MICROREAD_I2C_LLC_MAX_SIZE - 1]; 158 u8 tmp[MICROREAD_I2C_LLC_MAX_SIZE - 1];
161 struct i2c_client *client = phy->i2c_dev; 159 struct i2c_client *client = phy->i2c_dev;
162 160
163 pr_debug("%s\n", __func__);
164
165 r = i2c_master_recv(client, &len, 1); 161 r = i2c_master_recv(client, &len, 1);
166 if (r != 1) { 162 if (r != 1) {
167 dev_err(&client->dev, "cannot read len byte\n"); 163 nfc_err(&client->dev, "cannot read len byte\n");
168 return -EREMOTEIO; 164 return -EREMOTEIO;
169 } 165 }
170 166
171 if ((len < MICROREAD_I2C_LLC_MIN_SIZE) || 167 if ((len < MICROREAD_I2C_LLC_MIN_SIZE) ||
172 (len > MICROREAD_I2C_LLC_MAX_SIZE)) { 168 (len > MICROREAD_I2C_LLC_MAX_SIZE)) {
173 dev_err(&client->dev, "invalid len byte\n"); 169 nfc_err(&client->dev, "invalid len byte\n");
174 pr_err("invalid len byte\n");
175 r = -EBADMSG; 170 r = -EBADMSG;
176 goto flush; 171 goto flush;
177 } 172 }
@@ -228,7 +223,6 @@ static irqreturn_t microread_i2c_irq_thread_fn(int irq, void *phy_id)
228 } 223 }
229 224
230 client = phy->i2c_dev; 225 client = phy->i2c_dev;
231 dev_dbg(&client->dev, "IRQ\n");
232 226
233 if (phy->hard_fault != 0) 227 if (phy->hard_fault != 0)
234 return IRQ_HANDLED; 228 return IRQ_HANDLED;
@@ -263,20 +257,18 @@ static int microread_i2c_probe(struct i2c_client *client,
263 dev_get_platdata(&client->dev); 257 dev_get_platdata(&client->dev);
264 int r; 258 int r;
265 259
266 dev_dbg(&client->dev, "client %p", client); 260 dev_dbg(&client->dev, "client %p\n", client);
267 261
268 if (!pdata) { 262 if (!pdata) {
269 dev_err(&client->dev, "client %p: missing platform data", 263 nfc_err(&client->dev, "client %p: missing platform data\n",
270 client); 264 client);
271 return -EINVAL; 265 return -EINVAL;
272 } 266 }
273 267
274 phy = devm_kzalloc(&client->dev, sizeof(struct microread_i2c_phy), 268 phy = devm_kzalloc(&client->dev, sizeof(struct microread_i2c_phy),
275 GFP_KERNEL); 269 GFP_KERNEL);
276 if (!phy) { 270 if (!phy)
277 dev_err(&client->dev, "Can't allocate microread phy");
278 return -ENOMEM; 271 return -ENOMEM;
279 }
280 272
281 i2c_set_clientdata(client, phy); 273 i2c_set_clientdata(client, phy);
282 phy->i2c_dev = client; 274 phy->i2c_dev = client;
@@ -285,7 +277,7 @@ static int microread_i2c_probe(struct i2c_client *client,
285 IRQF_TRIGGER_RISING | IRQF_ONESHOT, 277 IRQF_TRIGGER_RISING | IRQF_ONESHOT,
286 MICROREAD_I2C_DRIVER_NAME, phy); 278 MICROREAD_I2C_DRIVER_NAME, phy);
287 if (r) { 279 if (r) {
288 dev_err(&client->dev, "Unable to register IRQ handler"); 280 nfc_err(&client->dev, "Unable to register IRQ handler\n");
289 return r; 281 return r;
290 } 282 }
291 283
@@ -296,7 +288,7 @@ static int microread_i2c_probe(struct i2c_client *client,
296 if (r < 0) 288 if (r < 0)
297 goto err_irq; 289 goto err_irq;
298 290
299 dev_info(&client->dev, "Probed"); 291 nfc_info(&client->dev, "Probed");
300 292
301 return 0; 293 return 0;
302 294
@@ -310,8 +302,6 @@ static int microread_i2c_remove(struct i2c_client *client)
310{ 302{
311 struct microread_i2c_phy *phy = i2c_get_clientdata(client); 303 struct microread_i2c_phy *phy = i2c_get_clientdata(client);
312 304
313 dev_dbg(&client->dev, "%s\n", __func__);
314
315 microread_remove(phy->hdev); 305 microread_remove(phy->hdev);
316 306
317 free_irq(client->irq, phy); 307 free_irq(client->irq, phy);
diff --git a/drivers/nfc/microread/mei.c b/drivers/nfc/microread/mei.c
index cdf1bc53b257..72fafec3d460 100644
--- a/drivers/nfc/microread/mei.c
+++ b/drivers/nfc/microread/mei.c
@@ -18,6 +18,8 @@
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */ 19 */
20 20
21#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
22
21#include <linux/module.h> 23#include <linux/module.h>
22#include <linux/mod_devicetable.h> 24#include <linux/mod_devicetable.h>
23#include <linux/nfc.h> 25#include <linux/nfc.h>
@@ -59,8 +61,6 @@ static int microread_mei_remove(struct mei_cl_device *device)
59{ 61{
60 struct nfc_mei_phy *phy = mei_cl_get_drvdata(device); 62 struct nfc_mei_phy *phy = mei_cl_get_drvdata(device);
61 63
62 pr_info("Removing microread\n");
63
64 microread_remove(phy->hdev); 64 microread_remove(phy->hdev);
65 65
66 nfc_mei_phy_free(phy); 66 nfc_mei_phy_free(phy);
diff --git a/drivers/nfc/microread/microread.c b/drivers/nfc/microread/microread.c
index cdb9f6de132a..970ded6bfcf5 100644
--- a/drivers/nfc/microread/microread.c
+++ b/drivers/nfc/microread/microread.c
@@ -18,6 +18,8 @@
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */ 19 */
20 20
21#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
22
21#include <linux/module.h> 23#include <linux/module.h>
22#include <linux/delay.h> 24#include <linux/delay.h>
23#include <linux/slab.h> 25#include <linux/slab.h>
@@ -546,7 +548,7 @@ exit:
546 kfree_skb(skb); 548 kfree_skb(skb);
547 549
548 if (r) 550 if (r)
549 pr_err("Failed to handle discovered target err=%d", r); 551 pr_err("Failed to handle discovered target err=%d\n", r);
550} 552}
551 553
552static int microread_event_received(struct nfc_hci_dev *hdev, u8 gate, 554static int microread_event_received(struct nfc_hci_dev *hdev, u8 gate,
@@ -656,7 +658,6 @@ int microread_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name,
656 658
657 info = kzalloc(sizeof(struct microread_info), GFP_KERNEL); 659 info = kzalloc(sizeof(struct microread_info), GFP_KERNEL);
658 if (!info) { 660 if (!info) {
659 pr_err("Cannot allocate memory for microread_info.\n");
660 r = -ENOMEM; 661 r = -ENOMEM;
661 goto err_info_alloc; 662 goto err_info_alloc;
662 } 663 }
@@ -686,7 +687,7 @@ int microread_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name,
686 MICROREAD_CMD_TAILROOM, 687 MICROREAD_CMD_TAILROOM,
687 phy_payload); 688 phy_payload);
688 if (!info->hdev) { 689 if (!info->hdev) {
689 pr_err("Cannot allocate nfc hdev.\n"); 690 pr_err("Cannot allocate nfc hdev\n");
690 r = -ENOMEM; 691 r = -ENOMEM;
691 goto err_alloc_hdev; 692 goto err_alloc_hdev;
692 } 693 }
diff --git a/drivers/nfc/nfcwilink.c b/drivers/nfc/nfcwilink.c
index ebf6da75bd40..0c79921b3870 100644
--- a/drivers/nfc/nfcwilink.c
+++ b/drivers/nfc/nfcwilink.c
@@ -171,7 +171,7 @@ static int nfcwilink_get_bts_file_name(struct nfcwilink *drv, char *file_name)
171 dev_dbg(&drv->pdev->dev, "wait_for_completion_timeout returned %ld\n", 171 dev_dbg(&drv->pdev->dev, "wait_for_completion_timeout returned %ld\n",
172 comp_ret); 172 comp_ret);
173 if (comp_ret == 0) { 173 if (comp_ret == 0) {
174 dev_err(&drv->pdev->dev, 174 nfc_err(&drv->pdev->dev,
175 "timeout on wait_for_completion_timeout\n"); 175 "timeout on wait_for_completion_timeout\n");
176 return -ETIMEDOUT; 176 return -ETIMEDOUT;
177 } 177 }
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c
index a66dff6ed51c..dc744eabeec1 100644
--- a/drivers/nfc/pn533.c
+++ b/drivers/nfc/pn533.c
@@ -1450,7 +1450,7 @@ static int pn533_target_found(struct pn533 *dev, u8 tg, u8 *tgdata,
1450 struct nfc_target nfc_tgt; 1450 struct nfc_target nfc_tgt;
1451 int rc; 1451 int rc;
1452 1452
1453 dev_dbg(&dev->interface->dev, "%s - modulation=%d\n", 1453 dev_dbg(&dev->interface->dev, "%s: modulation=%d\n",
1454 __func__, dev->poll_mod_curr); 1454 __func__, dev->poll_mod_curr);
1455 1455
1456 if (tg != 1) 1456 if (tg != 1)
@@ -2004,8 +2004,7 @@ static int pn533_activate_target(struct nfc_dev *nfc_dev,
2004 struct pn533 *dev = nfc_get_drvdata(nfc_dev); 2004 struct pn533 *dev = nfc_get_drvdata(nfc_dev);
2005 int rc; 2005 int rc;
2006 2006
2007 dev_dbg(&dev->interface->dev, "%s - protocol=%u\n", 2007 dev_dbg(&dev->interface->dev, "%s: protocol=%u\n", __func__, protocol);
2008 __func__, protocol);
2009 2008
2010 if (dev->poll_mod_count) { 2009 if (dev->poll_mod_count) {
2011 nfc_err(&dev->interface->dev, 2010 nfc_err(&dev->interface->dev,
diff --git a/drivers/nfc/pn544/i2c.c b/drivers/nfc/pn544/i2c.c
index 01e27d4bdd0d..b158ee1c2ac6 100644
--- a/drivers/nfc/pn544/i2c.c
+++ b/drivers/nfc/pn544/i2c.c
@@ -18,6 +18,8 @@
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */ 19 */
20 20
21#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
22
21#include <linux/crc-ccitt.h> 23#include <linux/crc-ccitt.h>
22#include <linux/module.h> 24#include <linux/module.h>
23#include <linux/i2c.h> 25#include <linux/i2c.h>
@@ -151,8 +153,7 @@ static void pn544_hci_i2c_platform_init(struct pn544_i2c_phy *phy)
151 char rset_cmd[] = { 0x05, 0xF9, 0x04, 0x00, 0xC3, 0xE5 }; 153 char rset_cmd[] = { 0x05, 0xF9, 0x04, 0x00, 0xC3, 0xE5 };
152 int count = sizeof(rset_cmd); 154 int count = sizeof(rset_cmd);
153 155
154 pr_info(DRIVER_DESC ": %s\n", __func__); 156 nfc_info(&phy->i2c_dev->dev, "Detecting nfc_en polarity\n");
155 dev_info(&phy->i2c_dev->dev, "Detecting nfc_en polarity\n");
156 157
157 /* Disable fw download */ 158 /* Disable fw download */
158 gpio_set_value(phy->gpio_fw, 0); 159 gpio_set_value(phy->gpio_fw, 0);
@@ -173,7 +174,7 @@ static void pn544_hci_i2c_platform_init(struct pn544_i2c_phy *phy)
173 dev_dbg(&phy->i2c_dev->dev, "Sending reset cmd\n"); 174 dev_dbg(&phy->i2c_dev->dev, "Sending reset cmd\n");
174 ret = i2c_master_send(phy->i2c_dev, rset_cmd, count); 175 ret = i2c_master_send(phy->i2c_dev, rset_cmd, count);
175 if (ret == count) { 176 if (ret == count) {
176 dev_info(&phy->i2c_dev->dev, 177 nfc_info(&phy->i2c_dev->dev,
177 "nfc_en polarity : active %s\n", 178 "nfc_en polarity : active %s\n",
178 (polarity == 0 ? "low" : "high")); 179 (polarity == 0 ? "low" : "high"));
179 goto out; 180 goto out;
@@ -181,7 +182,7 @@ static void pn544_hci_i2c_platform_init(struct pn544_i2c_phy *phy)
181 } 182 }
182 } 183 }
183 184
184 dev_err(&phy->i2c_dev->dev, 185 nfc_err(&phy->i2c_dev->dev,
185 "Could not detect nfc_en polarity, fallback to active high\n"); 186 "Could not detect nfc_en polarity, fallback to active high\n");
186 187
187out: 188out:
@@ -201,7 +202,7 @@ static int pn544_hci_i2c_enable(void *phy_id)
201{ 202{
202 struct pn544_i2c_phy *phy = phy_id; 203 struct pn544_i2c_phy *phy = phy_id;
203 204
204 pr_info(DRIVER_DESC ": %s\n", __func__); 205 pr_info("%s\n", __func__);
205 206
206 pn544_hci_i2c_enable_mode(phy, PN544_HCI_MODE); 207 pn544_hci_i2c_enable_mode(phy, PN544_HCI_MODE);
207 208
@@ -214,8 +215,6 @@ static void pn544_hci_i2c_disable(void *phy_id)
214{ 215{
215 struct pn544_i2c_phy *phy = phy_id; 216 struct pn544_i2c_phy *phy = phy_id;
216 217
217 pr_info(DRIVER_DESC ": %s\n", __func__);
218
219 gpio_set_value(phy->gpio_fw, 0); 218 gpio_set_value(phy->gpio_fw, 0);
220 gpio_set_value(phy->gpio_en, !phy->en_polarity); 219 gpio_set_value(phy->gpio_en, !phy->en_polarity);
221 usleep_range(10000, 15000); 220 usleep_range(10000, 15000);
@@ -298,11 +297,9 @@ static int check_crc(u8 *buf, int buflen)
298 crc = ~crc; 297 crc = ~crc;
299 298
300 if (buf[len - 2] != (crc & 0xff) || buf[len - 1] != (crc >> 8)) { 299 if (buf[len - 2] != (crc & 0xff) || buf[len - 1] != (crc >> 8)) {
301 pr_err(PN544_HCI_I2C_DRIVER_NAME 300 pr_err("CRC error 0x%x != 0x%x 0x%x\n",
302 ": CRC error 0x%x != 0x%x 0x%x\n",
303 crc, buf[len - 1], buf[len - 2]); 301 crc, buf[len - 1], buf[len - 2]);
304 302 pr_info("%s: BAD CRC\n", __func__);
305 pr_info(DRIVER_DESC ": %s : BAD CRC\n", __func__);
306 print_hex_dump(KERN_DEBUG, "crc: ", DUMP_PREFIX_NONE, 303 print_hex_dump(KERN_DEBUG, "crc: ", DUMP_PREFIX_NONE,
307 16, 2, buf, buflen, false); 304 16, 2, buf, buflen, false);
308 return -EPERM; 305 return -EPERM;
@@ -328,13 +325,13 @@ static int pn544_hci_i2c_read(struct pn544_i2c_phy *phy, struct sk_buff **skb)
328 325
329 r = i2c_master_recv(client, &len, 1); 326 r = i2c_master_recv(client, &len, 1);
330 if (r != 1) { 327 if (r != 1) {
331 dev_err(&client->dev, "cannot read len byte\n"); 328 nfc_err(&client->dev, "cannot read len byte\n");
332 return -EREMOTEIO; 329 return -EREMOTEIO;
333 } 330 }
334 331
335 if ((len < (PN544_HCI_I2C_LLC_MIN_SIZE - 1)) || 332 if ((len < (PN544_HCI_I2C_LLC_MIN_SIZE - 1)) ||
336 (len > (PN544_HCI_I2C_LLC_MAX_SIZE - 1))) { 333 (len > (PN544_HCI_I2C_LLC_MAX_SIZE - 1))) {
337 dev_err(&client->dev, "invalid len byte\n"); 334 nfc_err(&client->dev, "invalid len byte\n");
338 r = -EBADMSG; 335 r = -EBADMSG;
339 goto flush; 336 goto flush;
340 } 337 }
@@ -386,7 +383,7 @@ static int pn544_hci_i2c_fw_read_status(struct pn544_i2c_phy *phy)
386 383
387 r = i2c_master_recv(client, (char *) &response, sizeof(response)); 384 r = i2c_master_recv(client, (char *) &response, sizeof(response));
388 if (r != sizeof(response)) { 385 if (r != sizeof(response)) {
389 dev_err(&client->dev, "cannot read fw status\n"); 386 nfc_err(&client->dev, "cannot read fw status\n");
390 return -EIO; 387 return -EIO;
391 } 388 }
392 389
@@ -478,8 +475,7 @@ static int pn544_hci_i2c_fw_download(void *phy_id, const char *firmware_name)
478{ 475{
479 struct pn544_i2c_phy *phy = phy_id; 476 struct pn544_i2c_phy *phy = phy_id;
480 477
481 pr_info(DRIVER_DESC ": Starting Firmware Download (%s)\n", 478 pr_info("Starting Firmware Download (%s)\n", firmware_name);
482 firmware_name);
483 479
484 strcpy(phy->firmware_name, firmware_name); 480 strcpy(phy->firmware_name, firmware_name);
485 481
@@ -493,7 +489,7 @@ static int pn544_hci_i2c_fw_download(void *phy_id, const char *firmware_name)
493static void pn544_hci_i2c_fw_work_complete(struct pn544_i2c_phy *phy, 489static void pn544_hci_i2c_fw_work_complete(struct pn544_i2c_phy *phy,
494 int result) 490 int result)
495{ 491{
496 pr_info(DRIVER_DESC ": Firmware Download Complete, result=%d\n", result); 492 pr_info("Firmware Download Complete, result=%d\n", result);
497 493
498 pn544_hci_i2c_disable(phy); 494 pn544_hci_i2c_disable(phy);
499 495
@@ -694,14 +690,14 @@ static int pn544_hci_i2c_probe(struct i2c_client *client,
694 dev_dbg(&client->dev, "IRQ: %d\n", client->irq); 690 dev_dbg(&client->dev, "IRQ: %d\n", client->irq);
695 691
696 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { 692 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
697 dev_err(&client->dev, "Need I2C_FUNC_I2C\n"); 693 nfc_err(&client->dev, "Need I2C_FUNC_I2C\n");
698 return -ENODEV; 694 return -ENODEV;
699 } 695 }
700 696
701 phy = devm_kzalloc(&client->dev, sizeof(struct pn544_i2c_phy), 697 phy = devm_kzalloc(&client->dev, sizeof(struct pn544_i2c_phy),
702 GFP_KERNEL); 698 GFP_KERNEL);
703 if (!phy) { 699 if (!phy) {
704 dev_err(&client->dev, 700 nfc_err(&client->dev,
705 "Cannot allocate memory for pn544 i2c phy.\n"); 701 "Cannot allocate memory for pn544 i2c phy.\n");
706 return -ENOMEM; 702 return -ENOMEM;
707 } 703 }
@@ -714,18 +710,18 @@ static int pn544_hci_i2c_probe(struct i2c_client *client,
714 710
715 pdata = client->dev.platform_data; 711 pdata = client->dev.platform_data;
716 if (pdata == NULL) { 712 if (pdata == NULL) {
717 dev_err(&client->dev, "No platform data\n"); 713 nfc_err(&client->dev, "No platform data\n");
718 return -EINVAL; 714 return -EINVAL;
719 } 715 }
720 716
721 if (pdata->request_resources == NULL) { 717 if (pdata->request_resources == NULL) {
722 dev_err(&client->dev, "request_resources() missing\n"); 718 nfc_err(&client->dev, "request_resources() missing\n");
723 return -EINVAL; 719 return -EINVAL;
724 } 720 }
725 721
726 r = pdata->request_resources(client); 722 r = pdata->request_resources(client);
727 if (r) { 723 if (r) {
728 dev_err(&client->dev, "Cannot get platform resources\n"); 724 nfc_err(&client->dev, "Cannot get platform resources\n");
729 return r; 725 return r;
730 } 726 }
731 727
@@ -739,7 +735,7 @@ static int pn544_hci_i2c_probe(struct i2c_client *client,
739 IRQF_TRIGGER_RISING | IRQF_ONESHOT, 735 IRQF_TRIGGER_RISING | IRQF_ONESHOT,
740 PN544_HCI_I2C_DRIVER_NAME, phy); 736 PN544_HCI_I2C_DRIVER_NAME, phy);
741 if (r < 0) { 737 if (r < 0) {
742 dev_err(&client->dev, "Unable to register IRQ handler\n"); 738 nfc_err(&client->dev, "Unable to register IRQ handler\n");
743 goto err_rti; 739 goto err_rti;
744 } 740 }
745 741
diff --git a/drivers/nfc/pn544/pn544.c b/drivers/nfc/pn544/pn544.c
index b5048cbcc182..74cfa0a88b9e 100644
--- a/drivers/nfc/pn544/pn544.c
+++ b/drivers/nfc/pn544/pn544.c
@@ -18,6 +18,8 @@
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */ 19 */
20 20
21#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
22
21#include <linux/delay.h> 23#include <linux/delay.h>
22#include <linux/slab.h> 24#include <linux/slab.h>
23#include <linux/module.h> 25#include <linux/module.h>
@@ -391,7 +393,7 @@ static int pn544_hci_start_poll(struct nfc_hci_dev *hdev,
391 if ((im_protocols | tm_protocols) & NFC_PROTO_NFC_DEP_MASK) { 393 if ((im_protocols | tm_protocols) & NFC_PROTO_NFC_DEP_MASK) {
392 hdev->gb = nfc_get_local_general_bytes(hdev->ndev, 394 hdev->gb = nfc_get_local_general_bytes(hdev->ndev,
393 &hdev->gb_len); 395 &hdev->gb_len);
394 pr_debug("generate local bytes %p", hdev->gb); 396 pr_debug("generate local bytes %p\n", hdev->gb);
395 if (hdev->gb == NULL || hdev->gb_len == 0) { 397 if (hdev->gb == NULL || hdev->gb_len == 0) {
396 im_protocols &= ~NFC_PROTO_NFC_DEP_MASK; 398 im_protocols &= ~NFC_PROTO_NFC_DEP_MASK;
397 tm_protocols &= ~NFC_PROTO_NFC_DEP_MASK; 399 tm_protocols &= ~NFC_PROTO_NFC_DEP_MASK;
@@ -693,7 +695,7 @@ static int pn544_hci_tm_send(struct nfc_hci_dev *hdev, struct sk_buff *skb)
693static int pn544_hci_check_presence(struct nfc_hci_dev *hdev, 695static int pn544_hci_check_presence(struct nfc_hci_dev *hdev,
694 struct nfc_target *target) 696 struct nfc_target *target)
695{ 697{
696 pr_debug("supported protocol %d", target->supported_protocols); 698 pr_debug("supported protocol %d\b", target->supported_protocols);
697 if (target->supported_protocols & (NFC_PROTO_ISO14443_MASK | 699 if (target->supported_protocols & (NFC_PROTO_ISO14443_MASK |
698 NFC_PROTO_ISO14443_B_MASK)) { 700 NFC_PROTO_ISO14443_B_MASK)) {
699 return nfc_hci_send_cmd(hdev, target->hci_reader_gate, 701 return nfc_hci_send_cmd(hdev, target->hci_reader_gate,
@@ -730,7 +732,7 @@ static int pn544_hci_event_received(struct nfc_hci_dev *hdev, u8 gate, u8 event,
730 struct sk_buff *rgb_skb = NULL; 732 struct sk_buff *rgb_skb = NULL;
731 int r; 733 int r;
732 734
733 pr_debug("hci event %d", event); 735 pr_debug("hci event %d\n", event);
734 switch (event) { 736 switch (event) {
735 case PN544_HCI_EVT_ACTIVATED: 737 case PN544_HCI_EVT_ACTIVATED:
736 if (gate == PN544_RF_READER_NFCIP1_INITIATOR_GATE) { 738 if (gate == PN544_RF_READER_NFCIP1_INITIATOR_GATE) {
@@ -761,7 +763,7 @@ static int pn544_hci_event_received(struct nfc_hci_dev *hdev, u8 gate, u8 event,
761 } 763 }
762 764
763 if (skb->data[0] != 0) { 765 if (skb->data[0] != 0) {
764 pr_debug("data0 %d", skb->data[0]); 766 pr_debug("data0 %d\n", skb->data[0]);
765 r = -EPROTO; 767 r = -EPROTO;
766 goto exit; 768 goto exit;
767 } 769 }
@@ -922,7 +924,6 @@ int pn544_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name,
922 924
923 info = kzalloc(sizeof(struct pn544_hci_info), GFP_KERNEL); 925 info = kzalloc(sizeof(struct pn544_hci_info), GFP_KERNEL);
924 if (!info) { 926 if (!info) {
925 pr_err("Cannot allocate memory for pn544_hci_info.\n");
926 r = -ENOMEM; 927 r = -ENOMEM;
927 goto err_info_alloc; 928 goto err_info_alloc;
928 } 929 }
@@ -955,7 +956,7 @@ int pn544_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name,
955 phy_headroom + PN544_CMDS_HEADROOM, 956 phy_headroom + PN544_CMDS_HEADROOM,
956 phy_tailroom, phy_payload); 957 phy_tailroom, phy_payload);
957 if (!info->hdev) { 958 if (!info->hdev) {
958 pr_err("Cannot allocate nfc hdev.\n"); 959 pr_err("Cannot allocate nfc hdev\n");
959 r = -ENOMEM; 960 r = -ENOMEM;
960 goto err_alloc_hdev; 961 goto err_alloc_hdev;
961 } 962 }