Commit 17936b43 authored by Joe Perches's avatar Joe Perches Committed by Samuel Ortiz

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: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 073a625f
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/nfc.h> #include <linux/nfc.h>
...@@ -60,13 +62,13 @@ int nfc_mei_phy_enable(void *phy_id) ...@@ -60,13 +62,13 @@ int nfc_mei_phy_enable(void *phy_id)
r = mei_cl_enable_device(phy->device); r = mei_cl_enable_device(phy->device);
if (r < 0) { if (r < 0) {
pr_err("MEI_PHY: Could not enable device\n"); pr_err("Could not enable device\n");
return r; return r;
} }
r = mei_cl_register_event_cb(phy->device, nfc_mei_event_cb, phy); r = mei_cl_register_event_cb(phy->device, nfc_mei_event_cb, phy);
if (r) { if (r) {
pr_err("MEY_PHY: Event cb registration failed\n"); pr_err("Event cb registration failed\n");
mei_cl_disable_device(phy->device); mei_cl_disable_device(phy->device);
phy->powered = 0; phy->powered = 0;
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/delay.h> #include <linux/delay.h>
...@@ -95,12 +97,8 @@ static int check_crc(struct sk_buff *skb) ...@@ -95,12 +97,8 @@ static int check_crc(struct sk_buff *skb)
crc = crc ^ skb->data[i]; crc = crc ^ skb->data[i];
if (crc != skb->data[skb->len-1]) { if (crc != skb->data[skb->len-1]) {
pr_err(MICROREAD_I2C_DRIVER_NAME pr_err("CRC error 0x%x != 0x%x\n", crc, skb->data[skb->len-1]);
": CRC error 0x%x != 0x%x\n", pr_info("%s: BAD CRC\n", __func__);
crc, skb->data[skb->len-1]);
pr_info(DRIVER_DESC ": %s : BAD CRC\n", __func__);
return -EPERM; return -EPERM;
} }
...@@ -160,18 +158,15 @@ static int microread_i2c_read(struct microread_i2c_phy *phy, ...@@ -160,18 +158,15 @@ static int microread_i2c_read(struct microread_i2c_phy *phy,
u8 tmp[MICROREAD_I2C_LLC_MAX_SIZE - 1]; u8 tmp[MICROREAD_I2C_LLC_MAX_SIZE - 1];
struct i2c_client *client = phy->i2c_dev; struct i2c_client *client = phy->i2c_dev;
pr_debug("%s\n", __func__);
r = i2c_master_recv(client, &len, 1); r = i2c_master_recv(client, &len, 1);
if (r != 1) { if (r != 1) {
dev_err(&client->dev, "cannot read len byte\n"); nfc_err(&client->dev, "cannot read len byte\n");
return -EREMOTEIO; return -EREMOTEIO;
} }
if ((len < MICROREAD_I2C_LLC_MIN_SIZE) || if ((len < MICROREAD_I2C_LLC_MIN_SIZE) ||
(len > MICROREAD_I2C_LLC_MAX_SIZE)) { (len > MICROREAD_I2C_LLC_MAX_SIZE)) {
dev_err(&client->dev, "invalid len byte\n"); nfc_err(&client->dev, "invalid len byte\n");
pr_err("invalid len byte\n");
r = -EBADMSG; r = -EBADMSG;
goto flush; goto flush;
} }
...@@ -228,7 +223,6 @@ static irqreturn_t microread_i2c_irq_thread_fn(int irq, void *phy_id) ...@@ -228,7 +223,6 @@ static irqreturn_t microread_i2c_irq_thread_fn(int irq, void *phy_id)
} }
client = phy->i2c_dev; client = phy->i2c_dev;
dev_dbg(&client->dev, "IRQ\n");
if (phy->hard_fault != 0) if (phy->hard_fault != 0)
return IRQ_HANDLED; return IRQ_HANDLED;
...@@ -263,20 +257,18 @@ static int microread_i2c_probe(struct i2c_client *client, ...@@ -263,20 +257,18 @@ static int microread_i2c_probe(struct i2c_client *client,
dev_get_platdata(&client->dev); dev_get_platdata(&client->dev);
int r; int r;
dev_dbg(&client->dev, "client %p", client); dev_dbg(&client->dev, "client %p\n", client);
if (!pdata) { if (!pdata) {
dev_err(&client->dev, "client %p: missing platform data", nfc_err(&client->dev, "client %p: missing platform data\n",
client); client);
return -EINVAL; return -EINVAL;
} }
phy = devm_kzalloc(&client->dev, sizeof(struct microread_i2c_phy), phy = devm_kzalloc(&client->dev, sizeof(struct microread_i2c_phy),
GFP_KERNEL); GFP_KERNEL);
if (!phy) { if (!phy)
dev_err(&client->dev, "Can't allocate microread phy");
return -ENOMEM; return -ENOMEM;
}
i2c_set_clientdata(client, phy); i2c_set_clientdata(client, phy);
phy->i2c_dev = client; phy->i2c_dev = client;
...@@ -285,7 +277,7 @@ static int microread_i2c_probe(struct i2c_client *client, ...@@ -285,7 +277,7 @@ static int microread_i2c_probe(struct i2c_client *client,
IRQF_TRIGGER_RISING | IRQF_ONESHOT, IRQF_TRIGGER_RISING | IRQF_ONESHOT,
MICROREAD_I2C_DRIVER_NAME, phy); MICROREAD_I2C_DRIVER_NAME, phy);
if (r) { if (r) {
dev_err(&client->dev, "Unable to register IRQ handler"); nfc_err(&client->dev, "Unable to register IRQ handler\n");
return r; return r;
} }
...@@ -296,7 +288,7 @@ static int microread_i2c_probe(struct i2c_client *client, ...@@ -296,7 +288,7 @@ static int microread_i2c_probe(struct i2c_client *client,
if (r < 0) if (r < 0)
goto err_irq; goto err_irq;
dev_info(&client->dev, "Probed"); nfc_info(&client->dev, "Probed");
return 0; return 0;
...@@ -310,8 +302,6 @@ static int microread_i2c_remove(struct i2c_client *client) ...@@ -310,8 +302,6 @@ static int microread_i2c_remove(struct i2c_client *client)
{ {
struct microread_i2c_phy *phy = i2c_get_clientdata(client); struct microread_i2c_phy *phy = i2c_get_clientdata(client);
dev_dbg(&client->dev, "%s\n", __func__);
microread_remove(phy->hdev); microread_remove(phy->hdev);
free_irq(client->irq, phy); free_irq(client->irq, phy);
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/mod_devicetable.h> #include <linux/mod_devicetable.h>
#include <linux/nfc.h> #include <linux/nfc.h>
...@@ -59,8 +61,6 @@ static int microread_mei_remove(struct mei_cl_device *device) ...@@ -59,8 +61,6 @@ static int microread_mei_remove(struct mei_cl_device *device)
{ {
struct nfc_mei_phy *phy = mei_cl_get_drvdata(device); struct nfc_mei_phy *phy = mei_cl_get_drvdata(device);
pr_info("Removing microread\n");
microread_remove(phy->hdev); microread_remove(phy->hdev);
nfc_mei_phy_free(phy); nfc_mei_phy_free(phy);
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -546,7 +548,7 @@ static void microread_target_discovered(struct nfc_hci_dev *hdev, u8 gate, ...@@ -546,7 +548,7 @@ static void microread_target_discovered(struct nfc_hci_dev *hdev, u8 gate,
kfree_skb(skb); kfree_skb(skb);
if (r) if (r)
pr_err("Failed to handle discovered target err=%d", r); pr_err("Failed to handle discovered target err=%d\n", r);
} }
static int microread_event_received(struct nfc_hci_dev *hdev, u8 gate, static 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,7 +658,6 @@ int microread_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name,
info = kzalloc(sizeof(struct microread_info), GFP_KERNEL); info = kzalloc(sizeof(struct microread_info), GFP_KERNEL);
if (!info) { if (!info) {
pr_err("Cannot allocate memory for microread_info.\n");
r = -ENOMEM; r = -ENOMEM;
goto err_info_alloc; goto err_info_alloc;
} }
...@@ -686,7 +687,7 @@ int microread_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name, ...@@ -686,7 +687,7 @@ int microread_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name,
MICROREAD_CMD_TAILROOM, MICROREAD_CMD_TAILROOM,
phy_payload); phy_payload);
if (!info->hdev) { if (!info->hdev) {
pr_err("Cannot allocate nfc hdev.\n"); pr_err("Cannot allocate nfc hdev\n");
r = -ENOMEM; r = -ENOMEM;
goto err_alloc_hdev; goto err_alloc_hdev;
} }
......
...@@ -171,7 +171,7 @@ static int nfcwilink_get_bts_file_name(struct nfcwilink *drv, char *file_name) ...@@ -171,7 +171,7 @@ static int nfcwilink_get_bts_file_name(struct nfcwilink *drv, char *file_name)
dev_dbg(&drv->pdev->dev, "wait_for_completion_timeout returned %ld\n", dev_dbg(&drv->pdev->dev, "wait_for_completion_timeout returned %ld\n",
comp_ret); comp_ret);
if (comp_ret == 0) { if (comp_ret == 0) {
dev_err(&drv->pdev->dev, nfc_err(&drv->pdev->dev,
"timeout on wait_for_completion_timeout\n"); "timeout on wait_for_completion_timeout\n");
return -ETIMEDOUT; return -ETIMEDOUT;
} }
......
...@@ -1450,7 +1450,7 @@ static int pn533_target_found(struct pn533 *dev, u8 tg, u8 *tgdata, ...@@ -1450,7 +1450,7 @@ static int pn533_target_found(struct pn533 *dev, u8 tg, u8 *tgdata,
struct nfc_target nfc_tgt; struct nfc_target nfc_tgt;
int rc; int rc;
dev_dbg(&dev->interface->dev, "%s - modulation=%d\n", dev_dbg(&dev->interface->dev, "%s: modulation=%d\n",
__func__, dev->poll_mod_curr); __func__, dev->poll_mod_curr);
if (tg != 1) if (tg != 1)
...@@ -2004,8 +2004,7 @@ static int pn533_activate_target(struct nfc_dev *nfc_dev, ...@@ -2004,8 +2004,7 @@ static int pn533_activate_target(struct nfc_dev *nfc_dev,
struct pn533 *dev = nfc_get_drvdata(nfc_dev); struct pn533 *dev = nfc_get_drvdata(nfc_dev);
int rc; int rc;
dev_dbg(&dev->interface->dev, "%s - protocol=%u\n", dev_dbg(&dev->interface->dev, "%s: protocol=%u\n", __func__, protocol);
__func__, protocol);
if (dev->poll_mod_count) { if (dev->poll_mod_count) {
nfc_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/crc-ccitt.h> #include <linux/crc-ccitt.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/i2c.h> #include <linux/i2c.h>
...@@ -151,8 +153,7 @@ static void pn544_hci_i2c_platform_init(struct pn544_i2c_phy *phy) ...@@ -151,8 +153,7 @@ static void pn544_hci_i2c_platform_init(struct pn544_i2c_phy *phy)
char rset_cmd[] = { 0x05, 0xF9, 0x04, 0x00, 0xC3, 0xE5 }; char rset_cmd[] = { 0x05, 0xF9, 0x04, 0x00, 0xC3, 0xE5 };
int count = sizeof(rset_cmd); int count = sizeof(rset_cmd);
pr_info(DRIVER_DESC ": %s\n", __func__); nfc_info(&phy->i2c_dev->dev, "Detecting nfc_en polarity\n");
dev_info(&phy->i2c_dev->dev, "Detecting nfc_en polarity\n");
/* Disable fw download */ /* Disable fw download */
gpio_set_value(phy->gpio_fw, 0); gpio_set_value(phy->gpio_fw, 0);
...@@ -173,7 +174,7 @@ static void pn544_hci_i2c_platform_init(struct pn544_i2c_phy *phy) ...@@ -173,7 +174,7 @@ static void pn544_hci_i2c_platform_init(struct pn544_i2c_phy *phy)
dev_dbg(&phy->i2c_dev->dev, "Sending reset cmd\n"); dev_dbg(&phy->i2c_dev->dev, "Sending reset cmd\n");
ret = i2c_master_send(phy->i2c_dev, rset_cmd, count); ret = i2c_master_send(phy->i2c_dev, rset_cmd, count);
if (ret == count) { if (ret == count) {
dev_info(&phy->i2c_dev->dev, nfc_info(&phy->i2c_dev->dev,
"nfc_en polarity : active %s\n", "nfc_en polarity : active %s\n",
(polarity == 0 ? "low" : "high")); (polarity == 0 ? "low" : "high"));
goto out; goto out;
...@@ -181,7 +182,7 @@ static void pn544_hci_i2c_platform_init(struct pn544_i2c_phy *phy) ...@@ -181,7 +182,7 @@ static void pn544_hci_i2c_platform_init(struct pn544_i2c_phy *phy)
} }
} }
dev_err(&phy->i2c_dev->dev, nfc_err(&phy->i2c_dev->dev,
"Could not detect nfc_en polarity, fallback to active high\n"); "Could not detect nfc_en polarity, fallback to active high\n");
out: out:
...@@ -201,7 +202,7 @@ static int pn544_hci_i2c_enable(void *phy_id) ...@@ -201,7 +202,7 @@ static int pn544_hci_i2c_enable(void *phy_id)
{ {
struct pn544_i2c_phy *phy = phy_id; struct pn544_i2c_phy *phy = phy_id;
pr_info(DRIVER_DESC ": %s\n", __func__); pr_info("%s\n", __func__);
pn544_hci_i2c_enable_mode(phy, PN544_HCI_MODE); pn544_hci_i2c_enable_mode(phy, PN544_HCI_MODE);
...@@ -214,8 +215,6 @@ static void pn544_hci_i2c_disable(void *phy_id) ...@@ -214,8 +215,6 @@ static void pn544_hci_i2c_disable(void *phy_id)
{ {
struct pn544_i2c_phy *phy = phy_id; struct pn544_i2c_phy *phy = phy_id;
pr_info(DRIVER_DESC ": %s\n", __func__);
gpio_set_value(phy->gpio_fw, 0); gpio_set_value(phy->gpio_fw, 0);
gpio_set_value(phy->gpio_en, !phy->en_polarity); gpio_set_value(phy->gpio_en, !phy->en_polarity);
usleep_range(10000, 15000); usleep_range(10000, 15000);
...@@ -298,11 +297,9 @@ static int check_crc(u8 *buf, int buflen) ...@@ -298,11 +297,9 @@ static int check_crc(u8 *buf, int buflen)
crc = ~crc; crc = ~crc;
if (buf[len - 2] != (crc & 0xff) || buf[len - 1] != (crc >> 8)) { if (buf[len - 2] != (crc & 0xff) || buf[len - 1] != (crc >> 8)) {
pr_err(PN544_HCI_I2C_DRIVER_NAME pr_err("CRC error 0x%x != 0x%x 0x%x\n",
": CRC error 0x%x != 0x%x 0x%x\n",
crc, buf[len - 1], buf[len - 2]); crc, buf[len - 1], buf[len - 2]);
pr_info("%s: BAD CRC\n", __func__);
pr_info(DRIVER_DESC ": %s : BAD CRC\n", __func__);
print_hex_dump(KERN_DEBUG, "crc: ", DUMP_PREFIX_NONE, print_hex_dump(KERN_DEBUG, "crc: ", DUMP_PREFIX_NONE,
16, 2, buf, buflen, false); 16, 2, buf, buflen, false);
return -EPERM; return -EPERM;
...@@ -328,13 +325,13 @@ static int pn544_hci_i2c_read(struct pn544_i2c_phy *phy, struct sk_buff **skb) ...@@ -328,13 +325,13 @@ static int pn544_hci_i2c_read(struct pn544_i2c_phy *phy, struct sk_buff **skb)
r = i2c_master_recv(client, &len, 1); r = i2c_master_recv(client, &len, 1);
if (r != 1) { if (r != 1) {
dev_err(&client->dev, "cannot read len byte\n"); nfc_err(&client->dev, "cannot read len byte\n");
return -EREMOTEIO; return -EREMOTEIO;
} }
if ((len < (PN544_HCI_I2C_LLC_MIN_SIZE - 1)) || if ((len < (PN544_HCI_I2C_LLC_MIN_SIZE - 1)) ||
(len > (PN544_HCI_I2C_LLC_MAX_SIZE - 1))) { (len > (PN544_HCI_I2C_LLC_MAX_SIZE - 1))) {
dev_err(&client->dev, "invalid len byte\n"); nfc_err(&client->dev, "invalid len byte\n");
r = -EBADMSG; r = -EBADMSG;
goto flush; goto flush;
} }
...@@ -386,7 +383,7 @@ static int pn544_hci_i2c_fw_read_status(struct pn544_i2c_phy *phy) ...@@ -386,7 +383,7 @@ static int pn544_hci_i2c_fw_read_status(struct pn544_i2c_phy *phy)
r = i2c_master_recv(client, (char *) &response, sizeof(response)); r = i2c_master_recv(client, (char *) &response, sizeof(response));
if (r != sizeof(response)) { if (r != sizeof(response)) {
dev_err(&client->dev, "cannot read fw status\n"); nfc_err(&client->dev, "cannot read fw status\n");
return -EIO; return -EIO;
} }
...@@ -478,8 +475,7 @@ static int pn544_hci_i2c_fw_download(void *phy_id, const char *firmware_name) ...@@ -478,8 +475,7 @@ static int pn544_hci_i2c_fw_download(void *phy_id, const char *firmware_name)
{ {
struct pn544_i2c_phy *phy = phy_id; struct pn544_i2c_phy *phy = phy_id;
pr_info(DRIVER_DESC ": Starting Firmware Download (%s)\n", pr_info("Starting Firmware Download (%s)\n", firmware_name);
firmware_name);
strcpy(phy->firmware_name, firmware_name); strcpy(phy->firmware_name, firmware_name);
...@@ -493,7 +489,7 @@ static int pn544_hci_i2c_fw_download(void *phy_id, const char *firmware_name) ...@@ -493,7 +489,7 @@ static int pn544_hci_i2c_fw_download(void *phy_id, const char *firmware_name)
static void pn544_hci_i2c_fw_work_complete(struct pn544_i2c_phy *phy, static void pn544_hci_i2c_fw_work_complete(struct pn544_i2c_phy *phy,
int result) int result)
{ {
pr_info(DRIVER_DESC ": Firmware Download Complete, result=%d\n", result); pr_info("Firmware Download Complete, result=%d\n", result);
pn544_hci_i2c_disable(phy); pn544_hci_i2c_disable(phy);
...@@ -694,14 +690,14 @@ static int pn544_hci_i2c_probe(struct i2c_client *client, ...@@ -694,14 +690,14 @@ static int pn544_hci_i2c_probe(struct i2c_client *client,
dev_dbg(&client->dev, "IRQ: %d\n", client->irq); dev_dbg(&client->dev, "IRQ: %d\n", client->irq);
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
dev_err(&client->dev, "Need I2C_FUNC_I2C\n"); nfc_err(&client->dev, "Need I2C_FUNC_I2C\n");
return -ENODEV; return -ENODEV;
} }
phy = devm_kzalloc(&client->dev, sizeof(struct pn544_i2c_phy), phy = devm_kzalloc(&client->dev, sizeof(struct pn544_i2c_phy),
GFP_KERNEL); GFP_KERNEL);
if (!phy) { if (!phy) {
dev_err(&client->dev, nfc_err(&client->dev,
"Cannot allocate memory for pn544 i2c phy.\n"); "Cannot allocate memory for pn544 i2c phy.\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -714,18 +710,18 @@ static int pn544_hci_i2c_probe(struct i2c_client *client, ...@@ -714,18 +710,18 @@ static int pn544_hci_i2c_probe(struct i2c_client *client,
pdata = client->dev.platform_data; pdata = client->dev.platform_data;
if (pdata == NULL) { if (pdata == NULL) {
dev_err(&client->dev, "No platform data\n"); nfc_err(&client->dev, "No platform data\n");
return -EINVAL; return -EINVAL;
} }
if (pdata->request_resources == NULL) { if (pdata->request_resources == NULL) {
dev_err(&client->dev, "request_resources() missing\n"); nfc_err(&client->dev, "request_resources() missing\n");
return -EINVAL; return -EINVAL;
} }
r = pdata->request_resources(client); r = pdata->request_resources(client);
if (r) { if (r) {
dev_err(&client->dev, "Cannot get platform resources\n"); nfc_err(&client->dev, "Cannot get platform resources\n");
return r; return r;
} }
...@@ -739,7 +735,7 @@ static int pn544_hci_i2c_probe(struct i2c_client *client, ...@@ -739,7 +735,7 @@ static int pn544_hci_i2c_probe(struct i2c_client *client,
IRQF_TRIGGER_RISING | IRQF_ONESHOT, IRQF_TRIGGER_RISING | IRQF_ONESHOT,
PN544_HCI_I2C_DRIVER_NAME, phy); PN544_HCI_I2C_DRIVER_NAME, phy);
if (r < 0) { if (r < 0) {
dev_err(&client->dev, "Unable to register IRQ handler\n"); nfc_err(&client->dev, "Unable to register IRQ handler\n");
goto err_rti; goto err_rti;
} }
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -391,7 +393,7 @@ static int pn544_hci_start_poll(struct nfc_hci_dev *hdev, ...@@ -391,7 +393,7 @@ static int pn544_hci_start_poll(struct nfc_hci_dev *hdev,
if ((im_protocols | tm_protocols) & NFC_PROTO_NFC_DEP_MASK) { if ((im_protocols | tm_protocols) & NFC_PROTO_NFC_DEP_MASK) {
hdev->gb = nfc_get_local_general_bytes(hdev->ndev, hdev->gb = nfc_get_local_general_bytes(hdev->ndev,
&hdev->gb_len); &hdev->gb_len);
pr_debug("generate local bytes %p", hdev->gb); pr_debug("generate local bytes %p\n", hdev->gb);
if (hdev->gb == NULL || hdev->gb_len == 0) { if (hdev->gb == NULL || hdev->gb_len == 0) {
im_protocols &= ~NFC_PROTO_NFC_DEP_MASK; im_protocols &= ~NFC_PROTO_NFC_DEP_MASK;
tm_protocols &= ~NFC_PROTO_NFC_DEP_MASK; 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) ...@@ -693,7 +695,7 @@ static int pn544_hci_tm_send(struct nfc_hci_dev *hdev, struct sk_buff *skb)
static int pn544_hci_check_presence(struct nfc_hci_dev *hdev, static int pn544_hci_check_presence(struct nfc_hci_dev *hdev,
struct nfc_target *target) struct nfc_target *target)
{ {
pr_debug("supported protocol %d", target->supported_protocols); pr_debug("supported protocol %d\b", target->supported_protocols);
if (target->supported_protocols & (NFC_PROTO_ISO14443_MASK | if (target->supported_protocols & (NFC_PROTO_ISO14443_MASK |
NFC_PROTO_ISO14443_B_MASK)) { NFC_PROTO_ISO14443_B_MASK)) {
return nfc_hci_send_cmd(hdev, target->hci_reader_gate, 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,7 +732,7 @@ static int pn544_hci_event_received(struct nfc_hci_dev *hdev, u8 gate, u8 event,
struct sk_buff *rgb_skb = NULL; struct sk_buff *rgb_skb = NULL;
int r; int r;
pr_debug("hci event %d", event); pr_debug("hci event %d\n", event);
switch (event) { switch (event) {
case PN544_HCI_EVT_ACTIVATED: case PN544_HCI_EVT_ACTIVATED:
if (gate == PN544_RF_READER_NFCIP1_INITIATOR_GATE) { 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,7 +763,7 @@ static int pn544_hci_event_received(struct nfc_hci_dev *hdev, u8 gate, u8 event,
} }
if (skb->data[0] != 0) { if (skb->data[0] != 0) {
pr_debug("data0 %d", skb->data[0]); pr_debug("data0 %d\n", skb->data[0]);
r = -EPROTO; r = -EPROTO;
goto exit; goto exit;
} }
...@@ -922,7 +924,6 @@ int pn544_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name, ...@@ -922,7 +924,6 @@ int pn544_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name,
info = kzalloc(sizeof(struct pn544_hci_info), GFP_KERNEL); info = kzalloc(sizeof(struct pn544_hci_info), GFP_KERNEL);
if (!info) { if (!info) {
pr_err("Cannot allocate memory for pn544_hci_info.\n");
r = -ENOMEM; r = -ENOMEM;
goto err_info_alloc; goto err_info_alloc;
} }
...@@ -955,7 +956,7 @@ int pn544_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name, ...@@ -955,7 +956,7 @@ int pn544_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name,
phy_headroom + PN544_CMDS_HEADROOM, phy_headroom + PN544_CMDS_HEADROOM,
phy_tailroom, phy_payload); phy_tailroom, phy_payload);
if (!info->hdev) { if (!info->hdev) {
pr_err("Cannot allocate nfc hdev.\n"); pr_err("Cannot allocate nfc hdev\n");
r = -ENOMEM; r = -ENOMEM;
goto err_alloc_hdev; goto err_alloc_hdev;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment