aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nfc/microread
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/microread
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/microread')
-rw-r--r--drivers/nfc/microread/i2c.c32
-rw-r--r--drivers/nfc/microread/mei.c4
-rw-r--r--drivers/nfc/microread/microread.c7
3 files changed, 17 insertions, 26 deletions
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 }