* [PATCH v3 01/14] NFC: fix attrs checks in netlink interface
@ 2019-07-25 19:34 Andy Shevchenko
2019-07-25 19:34 ` [PATCH v3 02/14] NFC: nxp-nci: Add NXP1001 to the ACPI ID table Andy Shevchenko
` (13 more replies)
0 siblings, 14 replies; 20+ messages in thread
From: Andy Shevchenko @ 2019-07-25 19:34 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, netdev, David S. Miller,
Sedat Dilek
Cc: Andrey Konovalov, Andy Shevchenko
From: Andrey Konovalov <andreyknvl@google.com>
nfc_genl_deactivate_target() relies on the NFC_ATTR_TARGET_INDEX
attribute being present, but doesn't check whether it is actually
provided by the user. Same goes for nfc_genl_fw_download() and
NFC_ATTR_FIRMWARE_NAME.
This patch adds appropriate checks.
Found with syzkaller.
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
net/nfc/netlink.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
index 4a30309bb67f..60fd2748d0ea 100644
--- a/net/nfc/netlink.c
+++ b/net/nfc/netlink.c
@@ -970,7 +970,8 @@ static int nfc_genl_dep_link_down(struct sk_buff *skb, struct genl_info *info)
int rc;
u32 idx;
- if (!info->attrs[NFC_ATTR_DEVICE_INDEX])
+ if (!info->attrs[NFC_ATTR_DEVICE_INDEX] ||
+ !info->attrs[NFC_ATTR_TARGET_INDEX])
return -EINVAL;
idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);
@@ -1018,7 +1019,8 @@ static int nfc_genl_llc_get_params(struct sk_buff *skb, struct genl_info *info)
struct sk_buff *msg = NULL;
u32 idx;
- if (!info->attrs[NFC_ATTR_DEVICE_INDEX])
+ if (!info->attrs[NFC_ATTR_DEVICE_INDEX] ||
+ !info->attrs[NFC_ATTR_FIRMWARE_NAME])
return -EINVAL;
idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);
--
2.20.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 02/14] NFC: nxp-nci: Add NXP1001 to the ACPI ID table
2019-07-25 19:34 [PATCH v3 01/14] NFC: fix attrs checks in netlink interface Andy Shevchenko
@ 2019-07-25 19:34 ` Andy Shevchenko
2019-07-25 19:35 ` [PATCH v3 03/14] NFC: nxp-nci: Get rid of platform data Andy Shevchenko
` (12 subsequent siblings)
13 siblings, 0 replies; 20+ messages in thread
From: Andy Shevchenko @ 2019-07-25 19:34 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, netdev, David S. Miller,
Sedat Dilek
Cc: Andy Shevchenko, Sedat Dilek
It seems a lot of laptops are equipped with NXP NFC300 chip with
the ACPI ID NXP1001 as per DSDT.
Append it to the driver's ACPI ID table.
Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
---
drivers/nfc/nxp-nci/i2c.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index 4aeb3861b409..5db71869f04b 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -396,6 +396,7 @@ MODULE_DEVICE_TABLE(of, of_nxp_nci_i2c_match);
#ifdef CONFIG_ACPI
static struct acpi_device_id acpi_id[] = {
+ { "NXP1001" },
{ "NXP7471" },
{ },
};
--
2.20.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 03/14] NFC: nxp-nci: Get rid of platform data
2019-07-25 19:34 [PATCH v3 01/14] NFC: fix attrs checks in netlink interface Andy Shevchenko
2019-07-25 19:34 ` [PATCH v3 02/14] NFC: nxp-nci: Add NXP1001 to the ACPI ID table Andy Shevchenko
@ 2019-07-25 19:35 ` Andy Shevchenko
2019-07-25 19:35 ` [PATCH v3 04/14] NFC: nxp-nci: Convert to use GPIO descriptor Andy Shevchenko
` (11 subsequent siblings)
13 siblings, 0 replies; 20+ messages in thread
From: Andy Shevchenko @ 2019-07-25 19:35 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, netdev, David S. Miller,
Sedat Dilek
Cc: Andy Shevchenko, Sedat Dilek
Legacy platform data must go away. We are on the safe side here since
there are no users of it in the kernel.
If anyone by any odd reason needs it the GPIO lookup tables and
built-in device properties at your service.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
---
MAINTAINERS | 1 -
drivers/nfc/nxp-nci/core.c | 1 -
drivers/nfc/nxp-nci/i2c.c | 9 +--------
drivers/nfc/nxp-nci/nxp-nci.h | 1 -
include/linux/platform_data/nxp-nci.h | 19 -------------------
5 files changed, 1 insertion(+), 30 deletions(-)
delete mode 100644 include/linux/platform_data/nxp-nci.h
diff --git a/MAINTAINERS b/MAINTAINERS
index 711b5d07f73d..e54e19f2c96d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11351,7 +11351,6 @@ F: include/net/nfc/
F: include/uapi/linux/nfc.h
F: drivers/nfc/
F: include/linux/platform_data/nfcmrvl.h
-F: include/linux/platform_data/nxp-nci.h
F: Documentation/devicetree/bindings/net/nfc/
NFS, SUNRPC, AND LOCKD CLIENTS
diff --git a/drivers/nfc/nxp-nci/core.c b/drivers/nfc/nxp-nci/core.c
index 8dafc696719f..aed18ca60170 100644
--- a/drivers/nfc/nxp-nci/core.c
+++ b/drivers/nfc/nxp-nci/core.c
@@ -14,7 +14,6 @@
#include <linux/gpio.h>
#include <linux/module.h>
#include <linux/nfc.h>
-#include <linux/platform_data/nxp-nci.h>
#include <net/nfc/nci_core.h>
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index 5db71869f04b..47b3b7e612e6 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -23,7 +23,6 @@
#include <linux/gpio/consumer.h>
#include <linux/of_gpio.h>
#include <linux/of_irq.h>
-#include <linux/platform_data/nxp-nci.h>
#include <asm/unaligned.h>
#include <net/nfc/nfc.h>
@@ -304,7 +303,6 @@ static int nxp_nci_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct nxp_nci_i2c_phy *phy;
- struct nxp_nci_nfc_platform_data *pdata;
int r;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
@@ -323,17 +321,12 @@ static int nxp_nci_i2c_probe(struct i2c_client *client,
phy->i2c_dev = client;
i2c_set_clientdata(client, phy);
- pdata = client->dev.platform_data;
-
- if (!pdata && client->dev.of_node) {
+ if (client->dev.of_node) {
r = nxp_nci_i2c_parse_devtree(client);
if (r < 0) {
nfc_err(&client->dev, "Failed to get DT data\n");
goto probe_exit;
}
- } else if (pdata) {
- phy->gpio_en = pdata->gpio_en;
- phy->gpio_fw = pdata->gpio_fw;
} else if (ACPI_HANDLE(&client->dev)) {
r = nxp_nci_i2c_acpi_config(phy);
if (r < 0)
diff --git a/drivers/nfc/nxp-nci/nxp-nci.h b/drivers/nfc/nxp-nci/nxp-nci.h
index 6fe7c45544bf..ae3fb2735a4e 100644
--- a/drivers/nfc/nxp-nci/nxp-nci.h
+++ b/drivers/nfc/nxp-nci/nxp-nci.h
@@ -14,7 +14,6 @@
#include <linux/completion.h>
#include <linux/firmware.h>
#include <linux/nfc.h>
-#include <linux/platform_data/nxp-nci.h>
#include <net/nfc/nci_core.h>
diff --git a/include/linux/platform_data/nxp-nci.h b/include/linux/platform_data/nxp-nci.h
deleted file mode 100644
index 97827ad468e2..000000000000
--- a/include/linux/platform_data/nxp-nci.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Generic platform data for the NXP NCI NFC chips.
- *
- * Copyright (C) 2014 NXP Semiconductors All rights reserved.
- *
- * Authors: Clément Perrochaud <clement.perrochaud@nxp.com>
- */
-
-#ifndef _NXP_NCI_H_
-#define _NXP_NCI_H_
-
-struct nxp_nci_nfc_platform_data {
- unsigned int gpio_en;
- unsigned int gpio_fw;
- unsigned int irq;
-};
-
-#endif /* _NXP_NCI_H_ */
--
2.20.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 04/14] NFC: nxp-nci: Convert to use GPIO descriptor
2019-07-25 19:34 [PATCH v3 01/14] NFC: fix attrs checks in netlink interface Andy Shevchenko
2019-07-25 19:34 ` [PATCH v3 02/14] NFC: nxp-nci: Add NXP1001 to the ACPI ID table Andy Shevchenko
2019-07-25 19:35 ` [PATCH v3 03/14] NFC: nxp-nci: Get rid of platform data Andy Shevchenko
@ 2019-07-25 19:35 ` Andy Shevchenko
2019-07-25 19:35 ` [PATCH v3 05/14] NFC: nxp-nci: Add GPIO ACPI mapping table Andy Shevchenko
` (10 subsequent siblings)
13 siblings, 0 replies; 20+ messages in thread
From: Andy Shevchenko @ 2019-07-25 19:35 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, netdev, David S. Miller,
Sedat Dilek
Cc: Andy Shevchenko, Sedat Dilek
Since we got rid of platform data, the driver may use
GPIO descriptor directly.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
---
drivers/nfc/nxp-nci/core.c | 1 -
drivers/nfc/nxp-nci/i2c.c | 60 ++++++++++----------------------------
2 files changed, 15 insertions(+), 46 deletions(-)
diff --git a/drivers/nfc/nxp-nci/core.c b/drivers/nfc/nxp-nci/core.c
index aed18ca60170..a0ce95a287c5 100644
--- a/drivers/nfc/nxp-nci/core.c
+++ b/drivers/nfc/nxp-nci/core.c
@@ -11,7 +11,6 @@
*/
#include <linux/delay.h>
-#include <linux/gpio.h>
#include <linux/module.h>
#include <linux/nfc.h>
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index 47b3b7e612e6..713c267acf88 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -21,8 +21,6 @@
#include <linux/module.h>
#include <linux/nfc.h>
#include <linux/gpio/consumer.h>
-#include <linux/of_gpio.h>
-#include <linux/of_irq.h>
#include <asm/unaligned.h>
#include <net/nfc/nfc.h>
@@ -37,8 +35,8 @@ struct nxp_nci_i2c_phy {
struct i2c_client *i2c_dev;
struct nci_dev *ndev;
- unsigned int gpio_en;
- unsigned int gpio_fw;
+ struct gpio_desc *gpiod_en;
+ struct gpio_desc *gpiod_fw;
int hard_fault; /*
* < 0 if hardware error occurred (e.g. i2c err)
@@ -51,8 +49,8 @@ static int nxp_nci_i2c_set_mode(void *phy_id,
{
struct nxp_nci_i2c_phy *phy = (struct nxp_nci_i2c_phy *) phy_id;
- gpio_set_value(phy->gpio_fw, (mode == NXP_NCI_MODE_FW) ? 1 : 0);
- gpio_set_value(phy->gpio_en, (mode != NXP_NCI_MODE_COLD) ? 1 : 0);
+ gpiod_set_value(phy->gpiod_fw, (mode == NXP_NCI_MODE_FW) ? 1 : 0);
+ gpiod_set_value(phy->gpiod_en, (mode != NXP_NCI_MODE_COLD) ? 1 : 0);
usleep_range(10000, 15000);
if (mode == NXP_NCI_MODE_COLD)
@@ -252,30 +250,18 @@ static irqreturn_t nxp_nci_i2c_irq_thread_fn(int irq, void *phy_id)
static int nxp_nci_i2c_parse_devtree(struct i2c_client *client)
{
struct nxp_nci_i2c_phy *phy = i2c_get_clientdata(client);
- struct device_node *pp;
- int r;
-
- pp = client->dev.of_node;
- if (!pp)
- return -ENODEV;
- r = of_get_named_gpio(pp, "enable-gpios", 0);
- if (r == -EPROBE_DEFER)
- r = of_get_named_gpio(pp, "enable-gpios", 0);
- if (r < 0) {
- nfc_err(&client->dev, "Failed to get EN gpio, error: %d\n", r);
- return r;
+ phy->gpiod_en = devm_gpiod_get(&client->dev, "enable", GPIOD_OUT_LOW);
+ if (IS_ERR(phy->gpiod_en)) {
+ nfc_err(&client->dev, "Failed to get EN gpio\n");
+ return PTR_ERR(phy->gpiod_en);
}
- phy->gpio_en = r;
- r = of_get_named_gpio(pp, "firmware-gpios", 0);
- if (r == -EPROBE_DEFER)
- r = of_get_named_gpio(pp, "firmware-gpios", 0);
- if (r < 0) {
- nfc_err(&client->dev, "Failed to get FW gpio, error: %d\n", r);
- return r;
+ phy->gpiod_fw = devm_gpiod_get(&client->dev, "firmware", GPIOD_OUT_LOW);
+ if (IS_ERR(phy->gpiod_fw)) {
+ nfc_err(&client->dev, "Failed to get FW gpio\n");
+ return PTR_ERR(phy->gpiod_fw);
}
- phy->gpio_fw = r;
return 0;
}
@@ -283,19 +269,15 @@ static int nxp_nci_i2c_parse_devtree(struct i2c_client *client)
static int nxp_nci_i2c_acpi_config(struct nxp_nci_i2c_phy *phy)
{
struct i2c_client *client = phy->i2c_dev;
- struct gpio_desc *gpiod_en, *gpiod_fw;
- gpiod_en = devm_gpiod_get_index(&client->dev, NULL, 2, GPIOD_OUT_LOW);
- gpiod_fw = devm_gpiod_get_index(&client->dev, NULL, 1, GPIOD_OUT_LOW);
+ phy->gpiod_en = devm_gpiod_get_index(&client->dev, NULL, 2, GPIOD_OUT_LOW);
+ phy->gpiod_fw = devm_gpiod_get_index(&client->dev, NULL, 1, GPIOD_OUT_LOW);
- if (IS_ERR(gpiod_en) || IS_ERR(gpiod_fw)) {
+ if (IS_ERR(phy->gpiod_en) || IS_ERR(phy->gpiod_fw)) {
nfc_err(&client->dev, "No GPIOs\n");
return -EINVAL;
}
- phy->gpio_en = desc_to_gpio(gpiod_en);
- phy->gpio_fw = desc_to_gpio(gpiod_fw);
-
return 0;
}
@@ -331,24 +313,12 @@ static int nxp_nci_i2c_probe(struct i2c_client *client,
r = nxp_nci_i2c_acpi_config(phy);
if (r < 0)
goto probe_exit;
- goto nci_probe;
} else {
nfc_err(&client->dev, "No platform data\n");
r = -EINVAL;
goto probe_exit;
}
- r = devm_gpio_request_one(&phy->i2c_dev->dev, phy->gpio_en,
- GPIOF_OUT_INIT_LOW, "nxp_nci_en");
- if (r < 0)
- goto probe_exit;
-
- r = devm_gpio_request_one(&phy->i2c_dev->dev, phy->gpio_fw,
- GPIOF_OUT_INIT_LOW, "nxp_nci_fw");
- if (r < 0)
- goto probe_exit;
-
-nci_probe:
r = nxp_nci_probe(phy, &client->dev, &i2c_phy_ops,
NXP_NCI_I2C_MAX_PAYLOAD, &phy->ndev);
if (r < 0)
--
2.20.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 05/14] NFC: nxp-nci: Add GPIO ACPI mapping table
2019-07-25 19:34 [PATCH v3 01/14] NFC: fix attrs checks in netlink interface Andy Shevchenko
` (2 preceding siblings ...)
2019-07-25 19:35 ` [PATCH v3 04/14] NFC: nxp-nci: Convert to use GPIO descriptor Andy Shevchenko
@ 2019-07-25 19:35 ` Andy Shevchenko
2019-07-25 19:35 ` [PATCH v3 06/14] NFC: nxp-nci: Get rid of code duplication in ->probe() Andy Shevchenko
` (9 subsequent siblings)
13 siblings, 0 replies; 20+ messages in thread
From: Andy Shevchenko @ 2019-07-25 19:35 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, netdev, David S. Miller,
Sedat Dilek
Cc: Andy Shevchenko, Sedat Dilek
In order to unify GPIO resource request prepare gpiod_get_index()
to behave correctly when there is no mapping provided by firmware.
Here we add explicit mapping between _CRS GpioIo() resources and
their names used in the driver.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
---
drivers/nfc/nxp-nci/i2c.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index 713c267acf88..7344405feddf 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -247,6 +247,15 @@ static irqreturn_t nxp_nci_i2c_irq_thread_fn(int irq, void *phy_id)
return IRQ_NONE;
}
+static const struct acpi_gpio_params firmware_gpios = { 1, 0, false };
+static const struct acpi_gpio_params enable_gpios = { 2, 0, false };
+
+static const struct acpi_gpio_mapping acpi_nxp_nci_gpios[] = {
+ { "enable-gpios", &enable_gpios, 1 },
+ { "firmware-gpios", &firmware_gpios, 1 },
+ { }
+};
+
static int nxp_nci_i2c_parse_devtree(struct i2c_client *client)
{
struct nxp_nci_i2c_phy *phy = i2c_get_clientdata(client);
@@ -269,9 +278,14 @@ static int nxp_nci_i2c_parse_devtree(struct i2c_client *client)
static int nxp_nci_i2c_acpi_config(struct nxp_nci_i2c_phy *phy)
{
struct i2c_client *client = phy->i2c_dev;
+ int r;
- phy->gpiod_en = devm_gpiod_get_index(&client->dev, NULL, 2, GPIOD_OUT_LOW);
- phy->gpiod_fw = devm_gpiod_get_index(&client->dev, NULL, 1, GPIOD_OUT_LOW);
+ r = devm_acpi_dev_add_driver_gpios(&client->dev, acpi_nxp_nci_gpios);
+ if (r)
+ return r;
+
+ phy->gpiod_en = devm_gpiod_get(&client->dev, "enable", GPIOD_OUT_LOW);
+ phy->gpiod_fw = devm_gpiod_get(&client->dev, "firmware", GPIOD_OUT_LOW);
if (IS_ERR(phy->gpiod_en) || IS_ERR(phy->gpiod_fw)) {
nfc_err(&client->dev, "No GPIOs\n");
--
2.20.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 06/14] NFC: nxp-nci: Get rid of code duplication in ->probe()
2019-07-25 19:34 [PATCH v3 01/14] NFC: fix attrs checks in netlink interface Andy Shevchenko
` (3 preceding siblings ...)
2019-07-25 19:35 ` [PATCH v3 05/14] NFC: nxp-nci: Add GPIO ACPI mapping table Andy Shevchenko
@ 2019-07-25 19:35 ` Andy Shevchenko
2019-07-25 19:35 ` [PATCH v3 07/14] NFC: nxp-nci: Get rid of useless label Andy Shevchenko
` (8 subsequent siblings)
13 siblings, 0 replies; 20+ messages in thread
From: Andy Shevchenko @ 2019-07-25 19:35 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, netdev, David S. Miller,
Sedat Dilek
Cc: Andy Shevchenko, Sedat Dilek
Since OF and ACPI case almost the same get rid of code duplication
by moving gpiod_get() calls directly to ->probe().
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
---
drivers/nfc/nxp-nci/i2c.c | 68 +++++++++------------------------------
1 file changed, 15 insertions(+), 53 deletions(-)
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index 7344405feddf..6a627d1b6f85 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -256,48 +256,10 @@ static const struct acpi_gpio_mapping acpi_nxp_nci_gpios[] = {
{ }
};
-static int nxp_nci_i2c_parse_devtree(struct i2c_client *client)
-{
- struct nxp_nci_i2c_phy *phy = i2c_get_clientdata(client);
-
- phy->gpiod_en = devm_gpiod_get(&client->dev, "enable", GPIOD_OUT_LOW);
- if (IS_ERR(phy->gpiod_en)) {
- nfc_err(&client->dev, "Failed to get EN gpio\n");
- return PTR_ERR(phy->gpiod_en);
- }
-
- phy->gpiod_fw = devm_gpiod_get(&client->dev, "firmware", GPIOD_OUT_LOW);
- if (IS_ERR(phy->gpiod_fw)) {
- nfc_err(&client->dev, "Failed to get FW gpio\n");
- return PTR_ERR(phy->gpiod_fw);
- }
-
- return 0;
-}
-
-static int nxp_nci_i2c_acpi_config(struct nxp_nci_i2c_phy *phy)
-{
- struct i2c_client *client = phy->i2c_dev;
- int r;
-
- r = devm_acpi_dev_add_driver_gpios(&client->dev, acpi_nxp_nci_gpios);
- if (r)
- return r;
-
- phy->gpiod_en = devm_gpiod_get(&client->dev, "enable", GPIOD_OUT_LOW);
- phy->gpiod_fw = devm_gpiod_get(&client->dev, "firmware", GPIOD_OUT_LOW);
-
- if (IS_ERR(phy->gpiod_en) || IS_ERR(phy->gpiod_fw)) {
- nfc_err(&client->dev, "No GPIOs\n");
- return -EINVAL;
- }
-
- return 0;
-}
-
static int nxp_nci_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
+ struct device *dev = &client->dev;
struct nxp_nci_i2c_phy *phy;
int r;
@@ -317,20 +279,20 @@ static int nxp_nci_i2c_probe(struct i2c_client *client,
phy->i2c_dev = client;
i2c_set_clientdata(client, phy);
- if (client->dev.of_node) {
- r = nxp_nci_i2c_parse_devtree(client);
- if (r < 0) {
- nfc_err(&client->dev, "Failed to get DT data\n");
- goto probe_exit;
- }
- } else if (ACPI_HANDLE(&client->dev)) {
- r = nxp_nci_i2c_acpi_config(phy);
- if (r < 0)
- goto probe_exit;
- } else {
- nfc_err(&client->dev, "No platform data\n");
- r = -EINVAL;
- goto probe_exit;
+ r = devm_acpi_dev_add_driver_gpios(dev, acpi_nxp_nci_gpios);
+ if (r)
+ return r;
+
+ phy->gpiod_en = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
+ if (IS_ERR(phy->gpiod_en)) {
+ nfc_err(dev, "Failed to get EN gpio\n");
+ return PTR_ERR(phy->gpiod_en);
+ }
+
+ phy->gpiod_fw = devm_gpiod_get(dev, "firmware", GPIOD_OUT_LOW);
+ if (IS_ERR(phy->gpiod_fw)) {
+ nfc_err(dev, "Failed to get FW gpio\n");
+ return PTR_ERR(phy->gpiod_fw);
}
r = nxp_nci_probe(phy, &client->dev, &i2c_phy_ops,
--
2.20.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 07/14] NFC: nxp-nci: Get rid of useless label
2019-07-25 19:34 [PATCH v3 01/14] NFC: fix attrs checks in netlink interface Andy Shevchenko
` (4 preceding siblings ...)
2019-07-25 19:35 ` [PATCH v3 06/14] NFC: nxp-nci: Get rid of code duplication in ->probe() Andy Shevchenko
@ 2019-07-25 19:35 ` Andy Shevchenko
2019-07-25 19:35 ` [PATCH v3 08/14] NFC: nxp-nci: Constify acpi_device_id Andy Shevchenko
` (7 subsequent siblings)
13 siblings, 0 replies; 20+ messages in thread
From: Andy Shevchenko @ 2019-07-25 19:35 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, netdev, David S. Miller,
Sedat Dilek
Cc: Andy Shevchenko, Sedat Dilek
Return directly in ->probe() since there no special cleaning is needed.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
---
drivers/nfc/nxp-nci/i2c.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index 6a627d1b6f85..bec9b1ea78e2 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -265,16 +265,13 @@ static int nxp_nci_i2c_probe(struct i2c_client *client,
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
nfc_err(&client->dev, "Need I2C_FUNC_I2C\n");
- r = -ENODEV;
- goto probe_exit;
+ return -ENODEV;
}
phy = devm_kzalloc(&client->dev, sizeof(struct nxp_nci_i2c_phy),
GFP_KERNEL);
- if (!phy) {
- r = -ENOMEM;
- goto probe_exit;
- }
+ if (!phy)
+ return -ENOMEM;
phy->i2c_dev = client;
i2c_set_clientdata(client, phy);
@@ -298,7 +295,7 @@ static int nxp_nci_i2c_probe(struct i2c_client *client,
r = nxp_nci_probe(phy, &client->dev, &i2c_phy_ops,
NXP_NCI_I2C_MAX_PAYLOAD, &phy->ndev);
if (r < 0)
- goto probe_exit;
+ return r;
r = request_threaded_irq(client->irq, NULL,
nxp_nci_i2c_irq_thread_fn,
@@ -307,7 +304,6 @@ static int nxp_nci_i2c_probe(struct i2c_client *client,
if (r < 0)
nfc_err(&client->dev, "Unable to register IRQ handler\n");
-probe_exit:
return r;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 08/14] NFC: nxp-nci: Constify acpi_device_id
2019-07-25 19:34 [PATCH v3 01/14] NFC: fix attrs checks in netlink interface Andy Shevchenko
` (5 preceding siblings ...)
2019-07-25 19:35 ` [PATCH v3 07/14] NFC: nxp-nci: Get rid of useless label Andy Shevchenko
@ 2019-07-25 19:35 ` Andy Shevchenko
2019-07-25 19:35 ` [PATCH v3 09/14] NFC: nxp-nci: Drop of_match_ptr() use Andy Shevchenko
` (6 subsequent siblings)
13 siblings, 0 replies; 20+ messages in thread
From: Andy Shevchenko @ 2019-07-25 19:35 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, netdev, David S. Miller,
Sedat Dilek
Cc: Andy Shevchenko, Sedat Dilek
The content of acpi_device_id is not supposed to change at runtime.
All functions working with acpi_device_id provided by <linux/acpi.h>
work with const acpi_device_id. So mark the non-const structs as const.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
---
drivers/nfc/nxp-nci/i2c.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index bec9b1ea78e2..4e71962dc557 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -330,7 +330,7 @@ static const struct of_device_id of_nxp_nci_i2c_match[] = {
MODULE_DEVICE_TABLE(of, of_nxp_nci_i2c_match);
#ifdef CONFIG_ACPI
-static struct acpi_device_id acpi_id[] = {
+static const struct acpi_device_id acpi_id[] = {
{ "NXP1001" },
{ "NXP7471" },
{ },
--
2.20.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 09/14] NFC: nxp-nci: Drop of_match_ptr() use
2019-07-25 19:34 [PATCH v3 01/14] NFC: fix attrs checks in netlink interface Andy Shevchenko
` (6 preceding siblings ...)
2019-07-25 19:35 ` [PATCH v3 08/14] NFC: nxp-nci: Constify acpi_device_id Andy Shevchenko
@ 2019-07-25 19:35 ` Andy Shevchenko
2019-07-25 19:35 ` [PATCH v3 10/14] NFC: nxp-nci: Drop comma in terminator lines Andy Shevchenko
` (5 subsequent siblings)
13 siblings, 0 replies; 20+ messages in thread
From: Andy Shevchenko @ 2019-07-25 19:35 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, netdev, David S. Miller,
Sedat Dilek
Cc: Andy Shevchenko, Sedat Dilek
There is no need to guard OF device ID table with of_match_ptr().
Otherwise we would get a defined but not used data.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
---
drivers/nfc/nxp-nci/i2c.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index 4e71962dc557..f2c8a560e265 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -342,7 +342,7 @@ static struct i2c_driver nxp_nci_i2c_driver = {
.driver = {
.name = NXP_NCI_I2C_DRIVER_NAME,
.acpi_match_table = ACPI_PTR(acpi_id),
- .of_match_table = of_match_ptr(of_nxp_nci_i2c_match),
+ .of_match_table = of_nxp_nci_i2c_match,
},
.probe = nxp_nci_i2c_probe,
.id_table = nxp_nci_i2c_id_table,
--
2.20.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 10/14] NFC: nxp-nci: Drop comma in terminator lines
2019-07-25 19:34 [PATCH v3 01/14] NFC: fix attrs checks in netlink interface Andy Shevchenko
` (7 preceding siblings ...)
2019-07-25 19:35 ` [PATCH v3 09/14] NFC: nxp-nci: Drop of_match_ptr() use Andy Shevchenko
@ 2019-07-25 19:35 ` Andy Shevchenko
2019-07-25 19:35 ` [PATCH v3 11/14] NFC: nxp-nci: Remove unused macro pr_fmt() Andy Shevchenko
` (4 subsequent siblings)
13 siblings, 0 replies; 20+ messages in thread
From: Andy Shevchenko @ 2019-07-25 19:35 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, netdev, David S. Miller,
Sedat Dilek
Cc: Andy Shevchenko, Sedat Dilek
There is no need to have a comma after terminator entry
in the arrays of IDs.
This may prevent the misguided addition behind the terminator
without compiler notice.
Drop the comma in terminator lines for good.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
---
drivers/nfc/nxp-nci/i2c.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index f2c8a560e265..59b0a02a813d 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -325,7 +325,7 @@ MODULE_DEVICE_TABLE(i2c, nxp_nci_i2c_id_table);
static const struct of_device_id of_nxp_nci_i2c_match[] = {
{ .compatible = "nxp,nxp-nci-i2c", },
- {},
+ {}
};
MODULE_DEVICE_TABLE(of, of_nxp_nci_i2c_match);
@@ -333,7 +333,7 @@ MODULE_DEVICE_TABLE(of, of_nxp_nci_i2c_match);
static const struct acpi_device_id acpi_id[] = {
{ "NXP1001" },
{ "NXP7471" },
- { },
+ { }
};
MODULE_DEVICE_TABLE(acpi, acpi_id);
#endif
--
2.20.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 11/14] NFC: nxp-nci: Remove unused macro pr_fmt()
2019-07-25 19:34 [PATCH v3 01/14] NFC: fix attrs checks in netlink interface Andy Shevchenko
` (8 preceding siblings ...)
2019-07-25 19:35 ` [PATCH v3 10/14] NFC: nxp-nci: Drop comma in terminator lines Andy Shevchenko
@ 2019-07-25 19:35 ` Andy Shevchenko
2019-07-26 21:23 ` David Miller
2019-07-25 19:35 ` [PATCH v3 12/14] NFC: nxp-nci: Remove 'default n' for the core Andy Shevchenko
` (3 subsequent siblings)
13 siblings, 1 reply; 20+ messages in thread
From: Andy Shevchenko @ 2019-07-25 19:35 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, netdev, David S. Miller,
Sedat Dilek
Cc: Andy Shevchenko, Sedat Dilek
The macro had never been used.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
---
drivers/nfc/nxp-nci/i2c.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index 59b0a02a813d..307bd2afbe05 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -12,8 +12,6 @@
* Copyright (C) 2012 Intel Corporation. All rights reserved.
*/
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/i2c.h>
--
2.20.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 12/14] NFC: nxp-nci: Remove 'default n' for the core
2019-07-25 19:34 [PATCH v3 01/14] NFC: fix attrs checks in netlink interface Andy Shevchenko
` (9 preceding siblings ...)
2019-07-25 19:35 ` [PATCH v3 11/14] NFC: nxp-nci: Remove unused macro pr_fmt() Andy Shevchenko
@ 2019-07-25 19:35 ` Andy Shevchenko
2019-07-25 19:35 ` [PATCH v3 13/14] NFC: nxp-nci: Clarify on supported chips Andy Shevchenko
` (2 subsequent siblings)
13 siblings, 0 replies; 20+ messages in thread
From: Andy Shevchenko @ 2019-07-25 19:35 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, netdev, David S. Miller,
Sedat Dilek
Cc: Andy Shevchenko, Sedat Dilek
It seems contributors follow the style of Kconfig entries where explicit
'default n' is present. The default 'default' is 'n' already, thus, drop
these lines from Kconfig to make it more clear.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
---
drivers/nfc/nxp-nci/Kconfig | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/nfc/nxp-nci/Kconfig b/drivers/nfc/nxp-nci/Kconfig
index 12df2c8cc51d..ed6cbdf0f0b4 100644
--- a/drivers/nfc/nxp-nci/Kconfig
+++ b/drivers/nfc/nxp-nci/Kconfig
@@ -2,7 +2,6 @@
config NFC_NXP_NCI
tristate "NXP-NCI NFC driver"
depends on NFC_NCI
- default n
---help---
Generic core driver for NXP NCI chips such as the NPC100
or PN7150 families.
--
2.20.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 13/14] NFC: nxp-nci: Clarify on supported chips
2019-07-25 19:34 [PATCH v3 01/14] NFC: fix attrs checks in netlink interface Andy Shevchenko
` (10 preceding siblings ...)
2019-07-25 19:35 ` [PATCH v3 12/14] NFC: nxp-nci: Remove 'default n' for the core Andy Shevchenko
@ 2019-07-25 19:35 ` Andy Shevchenko
2019-07-25 19:35 ` [PATCH v3 14/14] NFC: nxp-nci: Fix recommendation for NFC_NXP_NCI_I2C Kconfig Andy Shevchenko
2019-07-26 8:54 ` [PATCH v3 01/14] NFC: fix attrs checks in netlink interface Sedat Dilek
13 siblings, 0 replies; 20+ messages in thread
From: Andy Shevchenko @ 2019-07-25 19:35 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, netdev, David S. Miller,
Sedat Dilek
Cc: Andy Shevchenko, Oleg Zhurakivskyy
From: Sedat Dilek <sedat.dilek@credativ.de>
This patch clarifies on the supported NXP NCI chips and families
and lists PN547 and PN548 separately which are known as NPC100
respectively NPC300.
This helps to find informations and identify drivers on vendor's
support websites.
For details see the discussion in [1] and [2].
[1] https://marc.info/?t=155774435600001&r=1&w=2
[2] https://patchwork.kernel.org/project/linux-wireless/list/?submitter=33142
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Suggested-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
Signed-off-by: Sedat Dilek <sedat.dilek@credativ.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
---
drivers/nfc/nxp-nci/Kconfig | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/nfc/nxp-nci/Kconfig b/drivers/nfc/nxp-nci/Kconfig
index ed6cbdf0f0b4..746b91aa74f0 100644
--- a/drivers/nfc/nxp-nci/Kconfig
+++ b/drivers/nfc/nxp-nci/Kconfig
@@ -3,8 +3,8 @@ config NFC_NXP_NCI
tristate "NXP-NCI NFC driver"
depends on NFC_NCI
---help---
- Generic core driver for NXP NCI chips such as the NPC100
- or PN7150 families.
+ Generic core driver for NXP NCI chips such as the NPC100 (PN547),
+ NPC300 (PN548) or PN7150 families.
This is a driver based on the NCI NFC kernel layers and
will thus not work with NXP libnfc library.
--
2.20.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 14/14] NFC: nxp-nci: Fix recommendation for NFC_NXP_NCI_I2C Kconfig
2019-07-25 19:34 [PATCH v3 01/14] NFC: fix attrs checks in netlink interface Andy Shevchenko
` (11 preceding siblings ...)
2019-07-25 19:35 ` [PATCH v3 13/14] NFC: nxp-nci: Clarify on supported chips Andy Shevchenko
@ 2019-07-25 19:35 ` Andy Shevchenko
2019-07-26 8:54 ` [PATCH v3 01/14] NFC: fix attrs checks in netlink interface Sedat Dilek
13 siblings, 0 replies; 20+ messages in thread
From: Andy Shevchenko @ 2019-07-25 19:35 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, netdev, David S. Miller,
Sedat Dilek
Cc: Andy Shevchenko, Oleg Zhurakivskyy
From: Sedat Dilek <sedat.dilek@credativ.de>
This is a simple cleanup to the Kconfig help text as discussed in [1].
[1] https://marc.info/?t=155774435600001&r=1&w=2
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Suggested-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
Signed-off-by: Sedat Dilek <sedat.dilek@credativ.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/nfc/nxp-nci/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nfc/nxp-nci/Kconfig b/drivers/nfc/nxp-nci/Kconfig
index 746b91aa74f0..e1f71deab6fc 100644
--- a/drivers/nfc/nxp-nci/Kconfig
+++ b/drivers/nfc/nxp-nci/Kconfig
@@ -22,4 +22,4 @@ config NFC_NXP_NCI_I2C
To compile this driver as a module, choose m here. The module will
be called nxp_nci_i2c.
- Say Y if unsure.
+ Say N if unsure.
--
2.20.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH v3 01/14] NFC: fix attrs checks in netlink interface
2019-07-25 19:34 [PATCH v3 01/14] NFC: fix attrs checks in netlink interface Andy Shevchenko
` (12 preceding siblings ...)
2019-07-25 19:35 ` [PATCH v3 14/14] NFC: nxp-nci: Fix recommendation for NFC_NXP_NCI_I2C Kconfig Andy Shevchenko
@ 2019-07-26 8:54 ` Sedat Dilek
2019-07-26 11:44 ` Andy Shevchenko
13 siblings, 1 reply; 20+ messages in thread
From: Sedat Dilek @ 2019-07-26 8:54 UTC (permalink / raw)
To: Andy Shevchenko, Clément Perrochaud, Charles Gorand, netdev,
David S. Miller
Cc: Andrey Konovalov
[ Please CC me I am not subscribed to this ML ]
Hi Andy,
unfortunately, I did not found a cover-letter on netdev mailing-list.
So, I am answering here.
What are the changes v2->v3?
Again, unfortunately I throw away all v2 out of my local linux Git repository.
So, I could have looked at the diff myself.
Thanks for v3 upgrade!
Regards,
- Sedat -
[1] https://marc.info/?a=131071969100005&r=1&w=2
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> hat am 25. Juli 2019 21:34 geschrieben:
>
>
> From: Andrey Konovalov <andreyknvl@google.com>
>
> nfc_genl_deactivate_target() relies on the NFC_ATTR_TARGET_INDEX
> attribute being present, but doesn't check whether it is actually
> provided by the user. Same goes for nfc_genl_fw_download() and
> NFC_ATTR_FIRMWARE_NAME.
>
> This patch adds appropriate checks.
>
> Found with syzkaller.
>
> Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> net/nfc/netlink.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
> index 4a30309bb67f..60fd2748d0ea 100644
> --- a/net/nfc/netlink.c
> +++ b/net/nfc/netlink.c
> @@ -970,7 +970,8 @@ static int nfc_genl_dep_link_down(struct sk_buff *skb, struct genl_info *info)
> int rc;
> u32 idx;
>
> - if (!info->attrs[NFC_ATTR_DEVICE_INDEX])
> + if (!info->attrs[NFC_ATTR_DEVICE_INDEX] ||
> + !info->attrs[NFC_ATTR_TARGET_INDEX])
> return -EINVAL;
>
> idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);
> @@ -1018,7 +1019,8 @@ static int nfc_genl_llc_get_params(struct sk_buff *skb, struct genl_info *info)
> struct sk_buff *msg = NULL;
> u32 idx;
>
> - if (!info->attrs[NFC_ATTR_DEVICE_INDEX])
> + if (!info->attrs[NFC_ATTR_DEVICE_INDEX] ||
> + !info->attrs[NFC_ATTR_FIRMWARE_NAME])
> return -EINVAL;
>
> idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);
> --
> 2.20.1
--
Mit freundlichen Grüssen
Sedat Dilek
Telefon: +49 2166 9901-153
E-Mail: sedat.dilek@credativ.de
Internet: https://www.credativ.de/
GPG-Fingerprint: EA6D E17D D269 AC7E 101D C910 476F 2B3B 0AF7 F86B
credativ GmbH, Trompeterallee 108, 41189 Mönchengladbach
Handelsregister: Amtsgericht Mönchengladbach HRB 12080 USt-ID-Nummer DE204566209
Geschäftsführung: Dr. Michael Meskes, Jörg Folz, Sascha Heuer
Unser Umgang mit personenbezogenen Daten unterliegt folgenden Bestimmungen:
https://www.credativ.de/datenschutz/
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v3 01/14] NFC: fix attrs checks in netlink interface
2019-07-26 8:54 ` [PATCH v3 01/14] NFC: fix attrs checks in netlink interface Sedat Dilek
@ 2019-07-26 11:44 ` Andy Shevchenko
0 siblings, 0 replies; 20+ messages in thread
From: Andy Shevchenko @ 2019-07-26 11:44 UTC (permalink / raw)
To: Sedat Dilek
Cc: Clément Perrochaud, Charles Gorand, netdev, David S. Miller,
Andrey Konovalov
On Fri, Jul 26, 2019 at 10:54:22AM +0200, Sedat Dilek wrote:
> [ Please CC me I am not subscribed to this ML ]
>
> Hi Andy,
>
> unfortunately, I did not found a cover-letter on netdev mailing-list.
> So, I am answering here.
>
> What are the changes v2->v3?
I combined my 11 patches with 1 from syzkaller team and 2 from you.
That's only the change for the series.
Administratively I resent it to have updated Cc list.
> Again, unfortunately I throw away all v2 out of my local linux Git repository.
> So, I could have looked at the diff myself.
It should be no changes in the code.
>
> Thanks for v3 upgrade!
>
> Regards,
> - Sedat -
>
> [1] https://marc.info/?a=131071969100005&r=1&w=2
>
> > Andy Shevchenko <andriy.shevchenko@linux.intel.com> hat am 25. Juli 2019 21:34 geschrieben:
> >
> >
> > From: Andrey Konovalov <andreyknvl@google.com>
> >
> > nfc_genl_deactivate_target() relies on the NFC_ATTR_TARGET_INDEX
> > attribute being present, but doesn't check whether it is actually
> > provided by the user. Same goes for nfc_genl_fw_download() and
> > NFC_ATTR_FIRMWARE_NAME.
> >
> > This patch adds appropriate checks.
> >
> > Found with syzkaller.
> >
> > Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> > net/nfc/netlink.c | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
> > index 4a30309bb67f..60fd2748d0ea 100644
> > --- a/net/nfc/netlink.c
> > +++ b/net/nfc/netlink.c
> > @@ -970,7 +970,8 @@ static int nfc_genl_dep_link_down(struct sk_buff *skb, struct genl_info *info)
> > int rc;
> > u32 idx;
> >
> > - if (!info->attrs[NFC_ATTR_DEVICE_INDEX])
> > + if (!info->attrs[NFC_ATTR_DEVICE_INDEX] ||
> > + !info->attrs[NFC_ATTR_TARGET_INDEX])
> > return -EINVAL;
> >
> > idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);
> > @@ -1018,7 +1019,8 @@ static int nfc_genl_llc_get_params(struct sk_buff *skb, struct genl_info *info)
> > struct sk_buff *msg = NULL;
> > u32 idx;
> >
> > - if (!info->attrs[NFC_ATTR_DEVICE_INDEX])
> > + if (!info->attrs[NFC_ATTR_DEVICE_INDEX] ||
> > + !info->attrs[NFC_ATTR_FIRMWARE_NAME])
> > return -EINVAL;
> >
> > idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);
> > --
> > 2.20.1
>
>
> --
> Mit freundlichen Grüssen
> Sedat Dilek
> Telefon: +49 2166 9901-153
> E-Mail: sedat.dilek@credativ.de
> Internet: https://www.credativ.de/
>
> GPG-Fingerprint: EA6D E17D D269 AC7E 101D C910 476F 2B3B 0AF7 F86B
>
> credativ GmbH, Trompeterallee 108, 41189 Mönchengladbach
> Handelsregister: Amtsgericht Mönchengladbach HRB 12080 USt-ID-Nummer DE204566209
> Geschäftsführung: Dr. Michael Meskes, Jörg Folz, Sascha Heuer
>
> Unser Umgang mit personenbezogenen Daten unterliegt folgenden Bestimmungen:
> https://www.credativ.de/datenschutz/
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v3 11/14] NFC: nxp-nci: Remove unused macro pr_fmt()
2019-07-25 19:35 ` [PATCH v3 11/14] NFC: nxp-nci: Remove unused macro pr_fmt() Andy Shevchenko
@ 2019-07-26 21:23 ` David Miller
2019-07-29 9:40 ` Andy Shevchenko
0 siblings, 1 reply; 20+ messages in thread
From: David Miller @ 2019-07-26 21:23 UTC (permalink / raw)
To: andriy.shevchenko
Cc: clement.perrochaud, charles.gorand, netdev, sedat.dilek,
sedat.dilek
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: Thu, 25 Jul 2019 22:35:08 +0300
> The macro had never been used.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
...
> @@ -12,8 +12,6 @@
> * Copyright (C) 2012 Intel Corporation. All rights reserved.
> */
>
> -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
If there are any kernel log messages generated, which is the case in
this file, this is used.
Also, please resubmit this series with a proper header posting containing
a high level description of what this patch series does, how it is doing it,
and why it is doing it that way. Also include a changelog.
Thank you.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v3 11/14] NFC: nxp-nci: Remove unused macro pr_fmt()
2019-07-26 21:23 ` David Miller
@ 2019-07-29 9:40 ` Andy Shevchenko
2019-07-29 14:58 ` Sedat Dilek
0 siblings, 1 reply; 20+ messages in thread
From: Andy Shevchenko @ 2019-07-29 9:40 UTC (permalink / raw)
To: David Miller
Cc: clement.perrochaud, charles.gorand, netdev, sedat.dilek,
sedat.dilek
On Fri, Jul 26, 2019 at 02:23:46PM -0700, David Miller wrote:
> From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Date: Thu, 25 Jul 2019 22:35:08 +0300
>
> > The macro had never been used.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
> ...
> > @@ -12,8 +12,6 @@
> > * Copyright (C) 2012 Intel Corporation. All rights reserved.
> > */
> >
> > -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>
> If there are any kernel log messages generated, which is the case in
> this file, this is used.
AFAICS no, it's not.
All nfc_*() macros are built on top of dev_*() ones for which pr_fmt() is no-op.
If we would like to have it in that way, we rather should use dev_fmt().
> Also, please resubmit this series with a proper header posting containing
> a high level description of what this patch series does, how it is doing it,
> and why it is doing it that way. Also include a changelog.
Will do.
Thank you for review!
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v3 11/14] NFC: nxp-nci: Remove unused macro pr_fmt()
2019-07-29 9:40 ` Andy Shevchenko
@ 2019-07-29 14:58 ` Sedat Dilek
2019-07-29 15:08 ` Sedat Dilek
0 siblings, 1 reply; 20+ messages in thread
From: Sedat Dilek @ 2019-07-29 14:58 UTC (permalink / raw)
To: Andy Shevchenko
Cc: David Miller, clement.perrochaud, charles.gorand, netdev,
Sedat Dilek
On Mon, Jul 29, 2019 at 12:38 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Fri, Jul 26, 2019 at 02:23:46PM -0700, David Miller wrote:
> > From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Date: Thu, 25 Jul 2019 22:35:08 +0300
> >
> > > The macro had never been used.
> > >
> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
> > ...
> > > @@ -12,8 +12,6 @@
> > > * Copyright (C) 2012 Intel Corporation. All rights reserved.
> > > */
> > >
> > > -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> >
> > If there are any kernel log messages generated, which is the case in
> > this file, this is used.
>
> AFAICS no, it's not.
> All nfc_*() macros are built on top of dev_*() ones for which pr_fmt() is no-op.
> If we would like to have it in that way, we rather should use dev_fmt().
>
>
> > Also, please resubmit this series with a proper header posting containing
> > a high level description of what this patch series does, how it is doing it,
> > and why it is doing it that way. Also include a changelog.
>
> Will do.
>
> Thank you for review!
>
Can you send out the latest series as v5?
I got some new? patches from you, but a bit confused now.
- Sedat -
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v3 11/14] NFC: nxp-nci: Remove unused macro pr_fmt()
2019-07-29 14:58 ` Sedat Dilek
@ 2019-07-29 15:08 ` Sedat Dilek
0 siblings, 0 replies; 20+ messages in thread
From: Sedat Dilek @ 2019-07-29 15:08 UTC (permalink / raw)
To: Andy Shevchenko
Cc: David Miller, clement.perrochaud, charles.gorand, netdev,
Sedat Dilek
On Mon, Jul 29, 2019 at 4:58 PM Sedat Dilek <sedat.dilek@gmail.com> wrote:
>
> On Mon, Jul 29, 2019 at 12:38 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > On Fri, Jul 26, 2019 at 02:23:46PM -0700, David Miller wrote:
> > > From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > Date: Thu, 25 Jul 2019 22:35:08 +0300
> > >
> > > > The macro had never been used.
> > > >
> > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > > Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
> > > ...
> > > > @@ -12,8 +12,6 @@
> > > > * Copyright (C) 2012 Intel Corporation. All rights reserved.
> > > > */
> > > >
> > > > -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> > >
> > > If there are any kernel log messages generated, which is the case in
> > > this file, this is used.
> >
> > AFAICS no, it's not.
> > All nfc_*() macros are built on top of dev_*() ones for which pr_fmt() is no-op.
> > If we would like to have it in that way, we rather should use dev_fmt().
> >
> >
> > > Also, please resubmit this series with a proper header posting containing
> > > a high level description of what this patch series does, how it is doing it,
> > > and why it is doing it that way. Also include a changelog.
> >
> > Will do.
> >
> > Thank you for review!
> >
>
> Can you send out the latest series as v5?
> I got some new? patches from you, but a bit confused now.
>
Thanks for the cover-letter.
- Sedat -
[1] https://marc.info/?l=linux-netdev&m=156440732411578&w=2
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2019-07-29 15:08 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-25 19:34 [PATCH v3 01/14] NFC: fix attrs checks in netlink interface Andy Shevchenko
2019-07-25 19:34 ` [PATCH v3 02/14] NFC: nxp-nci: Add NXP1001 to the ACPI ID table Andy Shevchenko
2019-07-25 19:35 ` [PATCH v3 03/14] NFC: nxp-nci: Get rid of platform data Andy Shevchenko
2019-07-25 19:35 ` [PATCH v3 04/14] NFC: nxp-nci: Convert to use GPIO descriptor Andy Shevchenko
2019-07-25 19:35 ` [PATCH v3 05/14] NFC: nxp-nci: Add GPIO ACPI mapping table Andy Shevchenko
2019-07-25 19:35 ` [PATCH v3 06/14] NFC: nxp-nci: Get rid of code duplication in ->probe() Andy Shevchenko
2019-07-25 19:35 ` [PATCH v3 07/14] NFC: nxp-nci: Get rid of useless label Andy Shevchenko
2019-07-25 19:35 ` [PATCH v3 08/14] NFC: nxp-nci: Constify acpi_device_id Andy Shevchenko
2019-07-25 19:35 ` [PATCH v3 09/14] NFC: nxp-nci: Drop of_match_ptr() use Andy Shevchenko
2019-07-25 19:35 ` [PATCH v3 10/14] NFC: nxp-nci: Drop comma in terminator lines Andy Shevchenko
2019-07-25 19:35 ` [PATCH v3 11/14] NFC: nxp-nci: Remove unused macro pr_fmt() Andy Shevchenko
2019-07-26 21:23 ` David Miller
2019-07-29 9:40 ` Andy Shevchenko
2019-07-29 14:58 ` Sedat Dilek
2019-07-29 15:08 ` Sedat Dilek
2019-07-25 19:35 ` [PATCH v3 12/14] NFC: nxp-nci: Remove 'default n' for the core Andy Shevchenko
2019-07-25 19:35 ` [PATCH v3 13/14] NFC: nxp-nci: Clarify on supported chips Andy Shevchenko
2019-07-25 19:35 ` [PATCH v3 14/14] NFC: nxp-nci: Fix recommendation for NFC_NXP_NCI_I2C Kconfig Andy Shevchenko
2019-07-26 8:54 ` [PATCH v3 01/14] NFC: fix attrs checks in netlink interface Sedat Dilek
2019-07-26 11:44 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).