diff --git a/MAINTAINERS b/MAINTAINERS index f68dd1b99339..906000a4414a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -19114,6 +19114,7 @@ F: include/net/net_failover.h NFC SUBSYSTEM M: David Heidelberg L: oe-linux-nfc@lists.linux.dev +C: https://matrix.to/#/#linux-nfc:ixit.cz S: Maintained T: git https://codeberg.org/linux-nfc/linux.git F: Documentation/devicetree/bindings/net/nfc/ diff --git a/drivers/nfc/fdp/i2c.c b/drivers/nfc/fdp/i2c.c index c1896a1d978c..13d4387e79a0 100644 --- a/drivers/nfc/fdp/i2c.c +++ b/drivers/nfc/fdp/i2c.c @@ -349,8 +349,8 @@ static void fdp_nci_i2c_remove(struct i2c_client *client) } static const struct acpi_device_id fdp_nci_i2c_acpi_match[] = { - {"INT339A", 0}, - {} + { .id = "INT339A" }, + { } }; MODULE_DEVICE_TABLE(acpi, fdp_nci_i2c_acpi_match); diff --git a/drivers/nfc/microread/mei.c b/drivers/nfc/microread/mei.c index c256ae92d6b1..484e3ae0e875 100644 --- a/drivers/nfc/microread/mei.c +++ b/drivers/nfc/microread/mei.c @@ -48,10 +48,12 @@ static void microread_mei_remove(struct mei_cl_device *cldev) } static struct mei_cl_device_id microread_mei_tbl[] = { - { MICROREAD_DRIVER_NAME, MEI_NFC_UUID, MEI_CL_VERSION_ANY}, - - /* required last entry */ - { } + { + .name = MICROREAD_DRIVER_NAME, + .uuid = MEI_NFC_UUID, + .version = MEI_CL_VERSION_ANY, + }, + { /* required last entry */ } }; MODULE_DEVICE_TABLE(mei, microread_mei_tbl); diff --git a/drivers/nfc/nfcmrvl/i2c.c b/drivers/nfc/nfcmrvl/i2c.c index 66877a7d03f2..068c5d278a35 100644 --- a/drivers/nfc/nfcmrvl/i2c.c +++ b/drivers/nfc/nfcmrvl/i2c.c @@ -245,9 +245,9 @@ static void nfcmrvl_i2c_remove(struct i2c_client *client) } -static const struct of_device_id of_nfcmrvl_i2c_match[] __maybe_unused = { - { .compatible = "marvell,nfc-i2c", }, - {}, +static const struct of_device_id of_nfcmrvl_i2c_match[] = { + { .compatible = "marvell,nfc-i2c" }, + { } }; MODULE_DEVICE_TABLE(of, of_nfcmrvl_i2c_match); diff --git a/drivers/nfc/nfcmrvl/spi.c b/drivers/nfc/nfcmrvl/spi.c index 9c8cde1250fb..8b8f00dac0f8 100644 --- a/drivers/nfc/nfcmrvl/spi.c +++ b/drivers/nfc/nfcmrvl/spi.c @@ -168,6 +168,10 @@ static int nfcmrvl_spi_probe(struct spi_device *spi) drv_data->nci_spi = nci_spi_allocate_spi(drv_data->spi, 0, 10, drv_data->priv->ndev); + if (!drv_data->nci_spi) { + nfcmrvl_nci_unregister_dev(drv_data->priv); + return -ENOMEM; + } /* Init completion for slave handshake */ init_completion(&drv_data->handshake_completion); @@ -181,14 +185,14 @@ static void nfcmrvl_spi_remove(struct spi_device *spi) nfcmrvl_nci_unregister_dev(drv_data->priv); } -static const struct of_device_id of_nfcmrvl_spi_match[] __maybe_unused = { - { .compatible = "marvell,nfc-spi", }, - {}, +static const struct of_device_id of_nfcmrvl_spi_match[] = { + { .compatible = "marvell,nfc-spi" }, + { } }; MODULE_DEVICE_TABLE(of, of_nfcmrvl_spi_match); static const struct spi_device_id nfcmrvl_spi_id_table[] = { - { "nfcmrvl_spi", 0 }, + { .name = "nfcmrvl_spi" }, { } }; MODULE_DEVICE_TABLE(spi, nfcmrvl_spi_id_table); diff --git a/drivers/nfc/nfcmrvl/usb.c b/drivers/nfc/nfcmrvl/usb.c index 4babde8e4249..c7f2afe00b93 100644 --- a/drivers/nfc/nfcmrvl/usb.c +++ b/drivers/nfc/nfcmrvl/usb.c @@ -17,7 +17,6 @@ static struct usb_device_id nfcmrvl_table[] = { USB_CLASS_VENDOR_SPEC, 4, 1) }, { } /* Terminating entry */ }; - MODULE_DEVICE_TABLE(usb, nfcmrvl_table); #define NFCMRVL_USB_BULK_RUNNING 1 diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c index faebc89a7ef5..92ce096e9b18 100644 --- a/drivers/nfc/nxp-nci/i2c.c +++ b/drivers/nfc/nxp-nci/i2c.c @@ -334,8 +334,10 @@ static int nxp_nci_i2c_probe(struct i2c_client *client) nxp_nci_i2c_irq_thread_fn, irqflags | IRQF_ONESHOT, NXP_NCI_I2C_DRIVER_NAME, phy); - if (r < 0) + if (r < 0) { nfc_err(&client->dev, "Unable to register IRQ handler\n"); + nxp_nci_remove(phy->ndev); + } return r; } @@ -355,16 +357,16 @@ static const struct i2c_device_id nxp_nci_i2c_id_table[] = { 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", }, - {} + { .compatible = "nxp,nxp-nci-i2c" }, + { } }; MODULE_DEVICE_TABLE(of, of_nxp_nci_i2c_match); #ifdef CONFIG_ACPI static const struct acpi_device_id acpi_id[] = { - { "NXP1001" }, - { "NXP1002" }, - { "NXP7471" }, + { .id = "NXP1001" }, + { .id = "NXP1002" }, + { .id = "NXP7471" }, { } }; MODULE_DEVICE_TABLE(acpi, acpi_id); diff --git a/drivers/nfc/pn533/i2c.c b/drivers/nfc/pn533/i2c.c index 94aca9119f0f..66d201c14a40 100644 --- a/drivers/nfc/pn533/i2c.c +++ b/drivers/nfc/pn533/i2c.c @@ -236,15 +236,15 @@ static void pn533_i2c_remove(struct i2c_client *client) pn53x_common_clean(phy->priv); } -static const struct of_device_id of_pn533_i2c_match[] __maybe_unused = { - { .compatible = "nxp,pn532", }, +static const struct of_device_id of_pn533_i2c_match[] = { + { .compatible = "nxp,pn532" }, /* * NOTE: The use of the compatibles with the trailing "...-i2c" is * deprecated and will be removed. */ - { .compatible = "nxp,pn533-i2c", }, - { .compatible = "nxp,pn532-i2c", }, - {}, + { .compatible = "nxp,pn533-i2c" }, + { .compatible = "nxp,pn532-i2c" }, + { } }; MODULE_DEVICE_TABLE(of, of_pn533_i2c_match); diff --git a/drivers/nfc/pn533/pn533.c b/drivers/nfc/pn533/pn533.c index d7bdbc82e2ba..4e721a8dfd8b 100644 --- a/drivers/nfc/pn533/pn533.c +++ b/drivers/nfc/pn533/pn533.c @@ -740,8 +740,10 @@ static int pn533_target_found_type_a(struct nfc_target *nfc_tgt, u8 *tgt_data, struct pn533_target_felica { u8 pol_res; - u8 opcode; - u8 nfcid2[NFC_NFCID2_MAXSIZE]; + struct_group(sensf_res, + u8 opcode; + u8 nfcid2[NFC_NFCID2_MAXSIZE]; + ); u8 pad[8]; /* optional */ u8 syst_code[]; @@ -778,8 +780,8 @@ static int pn533_target_found_felica(struct nfc_target *nfc_tgt, u8 *tgt_data, else nfc_tgt->supported_protocols = NFC_PROTO_FELICA_MASK; - memcpy(nfc_tgt->sensf_res, &tgt_felica->opcode, 9); - nfc_tgt->sensf_res_len = 9; + memcpy(nfc_tgt->sensf_res, &tgt_felica->sensf_res, sizeof(tgt_felica->sensf_res)); + nfc_tgt->sensf_res_len = sizeof(tgt_felica->sensf_res); memcpy(nfc_tgt->nfcid2, tgt_felica->nfcid2, NFC_NFCID2_MAXSIZE); nfc_tgt->nfcid2_len = NFC_NFCID2_MAXSIZE; diff --git a/drivers/nfc/pn533/uart.c b/drivers/nfc/pn533/uart.c index e0d67cd2ac9b..83c1ccda0af6 100644 --- a/drivers/nfc/pn533/uart.c +++ b/drivers/nfc/pn533/uart.c @@ -238,8 +238,8 @@ static const struct serdev_device_ops pn532_serdev_ops = { }; static const struct of_device_id pn532_uart_of_match[] = { - { .compatible = "nxp,pn532", }, - {}, + { .compatible = "nxp,pn532" }, + { } }; MODULE_DEVICE_TABLE(of, pn532_uart_of_match); diff --git a/drivers/nfc/pn544/i2c.c b/drivers/nfc/pn544/i2c.c index dcfa96bd4345..7fde3aefae70 100644 --- a/drivers/nfc/pn544/i2c.c +++ b/drivers/nfc/pn544/i2c.c @@ -47,14 +47,12 @@ static const struct i2c_device_id pn544_hci_i2c_id_table[] = { { .name = "pn544" }, { } }; - MODULE_DEVICE_TABLE(i2c, pn544_hci_i2c_id_table); -static const struct acpi_device_id pn544_hci_i2c_acpi_match[] __maybe_unused = { - {"NXP5440", 0}, - {} +static const struct acpi_device_id pn544_hci_i2c_acpi_match[] = { + { .id = "NXP5440" }, + { } }; - MODULE_DEVICE_TABLE(acpi, pn544_hci_i2c_acpi_match); #define PN544_HCI_I2C_DRIVER_NAME "pn544_hci_i2c" @@ -939,9 +937,9 @@ static void pn544_hci_i2c_remove(struct i2c_client *client) pn544_hci_i2c_disable(phy); } -static const struct of_device_id of_pn544_i2c_match[] __maybe_unused = { - { .compatible = "nxp,pn544-i2c", }, - {}, +static const struct of_device_id of_pn544_i2c_match[] = { + { .compatible = "nxp,pn544-i2c" }, + { } }; MODULE_DEVICE_TABLE(of, of_pn544_i2c_match); diff --git a/drivers/nfc/pn544/mei.c b/drivers/nfc/pn544/mei.c index 3d3755cfa71e..7ca117186d3e 100644 --- a/drivers/nfc/pn544/mei.c +++ b/drivers/nfc/pn544/mei.c @@ -47,10 +47,12 @@ static void pn544_mei_remove(struct mei_cl_device *cldev) } static struct mei_cl_device_id pn544_mei_tbl[] = { - { PN544_DRIVER_NAME, MEI_NFC_UUID, MEI_CL_VERSION_ANY}, - - /* required last entry */ - { } + { + .name = PN544_DRIVER_NAME, + .uuid = MEI_NFC_UUID, + .version = MEI_CL_VERSION_ANY, + }, + { /* required last entry */ } }; MODULE_DEVICE_TABLE(mei, pn544_mei_tbl); diff --git a/drivers/nfc/port100.c b/drivers/nfc/port100.c index 5ae61d7ebcfe..b613f5e2fd57 100644 --- a/drivers/nfc/port100.c +++ b/drivers/nfc/port100.c @@ -1480,8 +1480,8 @@ static const struct nfc_digital_ops port100_digital_ops = { }; static const struct usb_device_id port100_table[] = { - { USB_DEVICE(SONY_VENDOR_ID, RCS380S_PRODUCT_ID), }, - { USB_DEVICE(SONY_VENDOR_ID, RCS380P_PRODUCT_ID), }, + { USB_DEVICE(SONY_VENDOR_ID, RCS380S_PRODUCT_ID) }, + { USB_DEVICE(SONY_VENDOR_ID, RCS380P_PRODUCT_ID) }, { } }; MODULE_DEVICE_TABLE(usb, port100_table); diff --git a/drivers/nfc/s3fwrn5/i2c.c b/drivers/nfc/s3fwrn5/i2c.c index e9a34d27a369..4ba762611711 100644 --- a/drivers/nfc/s3fwrn5/i2c.c +++ b/drivers/nfc/s3fwrn5/i2c.c @@ -210,9 +210,9 @@ static const struct i2c_device_id s3fwrn5_i2c_id_table[] = { }; MODULE_DEVICE_TABLE(i2c, s3fwrn5_i2c_id_table); -static const struct of_device_id of_s3fwrn5_i2c_match[] __maybe_unused = { - { .compatible = "samsung,s3fwrn5-i2c", }, - {} +static const struct of_device_id of_s3fwrn5_i2c_match[] = { + { .compatible = "samsung,s3fwrn5-i2c" }, + { } }; MODULE_DEVICE_TABLE(of, of_s3fwrn5_i2c_match); diff --git a/drivers/nfc/s3fwrn5/uart.c b/drivers/nfc/s3fwrn5/uart.c index e17c599a2da5..8f142a255101 100644 --- a/drivers/nfc/s3fwrn5/uart.c +++ b/drivers/nfc/s3fwrn5/uart.c @@ -85,8 +85,8 @@ static const struct serdev_device_ops s3fwrn82_serdev_ops = { }; static const struct of_device_id s3fwrn82_uart_of_match[] = { - { .compatible = "samsung,s3fwrn82", }, - {}, + { .compatible = "samsung,s3fwrn82" }, + { } }; MODULE_DEVICE_TABLE(of, s3fwrn82_uart_of_match); diff --git a/drivers/nfc/st-nci/i2c.c b/drivers/nfc/st-nci/i2c.c index 9ae839a6f5cc..152c20b6bb01 100644 --- a/drivers/nfc/st-nci/i2c.c +++ b/drivers/nfc/st-nci/i2c.c @@ -262,18 +262,18 @@ static const struct i2c_device_id st_nci_i2c_id_table[] = { }; MODULE_DEVICE_TABLE(i2c, st_nci_i2c_id_table); -static const struct acpi_device_id st_nci_i2c_acpi_match[] __maybe_unused = { - {"SMO2101"}, - {"SMO2102"}, - {} +static const struct acpi_device_id st_nci_i2c_acpi_match[] = { + { .id = "SMO2101" }, + { .id = "SMO2102" }, + { } }; MODULE_DEVICE_TABLE(acpi, st_nci_i2c_acpi_match); -static const struct of_device_id of_st_nci_i2c_match[] __maybe_unused = { - { .compatible = "st,st21nfcb-i2c", }, - { .compatible = "st,st21nfcb_i2c", }, - { .compatible = "st,st21nfcc-i2c", }, - {} +static const struct of_device_id of_st_nci_i2c_match[] = { + { .compatible = "st,st21nfcb-i2c" }, + { .compatible = "st,st21nfcb_i2c" }, + { .compatible = "st,st21nfcc-i2c" }, + { } }; MODULE_DEVICE_TABLE(of, of_st_nci_i2c_match); diff --git a/drivers/nfc/st-nci/spi.c b/drivers/nfc/st-nci/spi.c index 169eacc0a32a..7948c7e0c88c 100644 --- a/drivers/nfc/st-nci/spi.c +++ b/drivers/nfc/st-nci/spi.c @@ -271,21 +271,21 @@ static void st_nci_spi_remove(struct spi_device *dev) } static struct spi_device_id st_nci_spi_id_table[] = { - {ST_NCI_SPI_DRIVER_NAME, 0}, - {"st21nfcb-spi", 0}, - {} + { .name = ST_NCI_SPI_DRIVER_NAME }, + { .name = "st21nfcb-spi" }, + { } }; MODULE_DEVICE_TABLE(spi, st_nci_spi_id_table); -static const struct acpi_device_id st_nci_spi_acpi_match[] __maybe_unused = { - {"SMO2101", 0}, - {} +static const struct acpi_device_id st_nci_spi_acpi_match[] = { + { .id = "SMO2101" }, + { } }; MODULE_DEVICE_TABLE(acpi, st_nci_spi_acpi_match); -static const struct of_device_id of_st_nci_spi_match[] __maybe_unused = { - { .compatible = "st,st21nfcb-spi", }, - {} +static const struct of_device_id of_st_nci_spi_match[] = { + { .compatible = "st,st21nfcb-spi" }, + { } }; MODULE_DEVICE_TABLE(of, of_st_nci_spi_match); diff --git a/drivers/nfc/st21nfca/i2c.c b/drivers/nfc/st21nfca/i2c.c index aa5f4922b6b0..a4c93ff7c5b0 100644 --- a/drivers/nfc/st21nfca/i2c.c +++ b/drivers/nfc/st21nfca/i2c.c @@ -577,16 +577,16 @@ static const struct i2c_device_id st21nfca_hci_i2c_id_table[] = { }; MODULE_DEVICE_TABLE(i2c, st21nfca_hci_i2c_id_table); -static const struct acpi_device_id st21nfca_hci_i2c_acpi_match[] __maybe_unused = { - {"SMO2100", 0}, - {} +static const struct acpi_device_id st21nfca_hci_i2c_acpi_match[] = { + { .id = "SMO2100" }, + { } }; MODULE_DEVICE_TABLE(acpi, st21nfca_hci_i2c_acpi_match); -static const struct of_device_id of_st21nfca_i2c_match[] __maybe_unused = { - { .compatible = "st,st21nfca-i2c", }, - { .compatible = "st,st21nfca_i2c", }, - {} +static const struct of_device_id of_st21nfca_i2c_match[] = { + { .compatible = "st,st21nfca-i2c" }, + { .compatible = "st,st21nfca_i2c" }, + { } }; MODULE_DEVICE_TABLE(of, of_st21nfca_i2c_match); diff --git a/drivers/nfc/st95hf/core.c b/drivers/nfc/st95hf/core.c index ffe5b4eab457..4d772a308bff 100644 --- a/drivers/nfc/st95hf/core.c +++ b/drivers/nfc/st95hf/core.c @@ -450,19 +450,19 @@ static int st95hf_select_protocol(struct st95hf_context *stcontext, int type) static void st95hf_send_st95enable_negativepulse(struct st95hf_context *st95con) { /* First make irq_in pin high */ - gpiod_set_value(st95con->enable_gpiod, HIGH); + gpiod_set_value_cansleep(st95con->enable_gpiod, HIGH); /* wait for 1 milisecond */ usleep_range(1000, 2000); /* Make irq_in pin low */ - gpiod_set_value(st95con->enable_gpiod, LOW); + gpiod_set_value_cansleep(st95con->enable_gpiod, LOW); /* wait for minimum interrupt pulse to make st95 active */ usleep_range(1000, 2000); /* At end make it high */ - gpiod_set_value(st95con->enable_gpiod, HIGH); + gpiod_set_value_cansleep(st95con->enable_gpiod, HIGH); } /* @@ -1049,14 +1049,14 @@ static const struct nfc_digital_ops st95hf_nfc_digital_ops = { }; static const struct spi_device_id st95hf_id[] = { - { "st95hf", 0 }, - {} + { .name = "st95hf" }, + { } }; MODULE_DEVICE_TABLE(spi, st95hf_id); -static const struct of_device_id st95hf_spi_of_match[] __maybe_unused = { +static const struct of_device_id st95hf_spi_of_match[] = { { .compatible = "st,st95hf" }, - {}, + { } }; MODULE_DEVICE_TABLE(of, st95hf_spi_of_match); diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c index f22e091019de..60883001fa5d 100644 --- a/drivers/nfc/trf7970a.c +++ b/drivers/nfc/trf7970a.c @@ -938,7 +938,7 @@ static irqreturn_t trf7970a_irq(int irq, void *dev_id) if (!trf->timeout) { trf->ignore_timeout = !cancel_delayed_work(&trf->timeout_work); - trf->rx_skb = ERR_PTR(0); + trf->rx_skb = NULL; trf7970a_send_upstream(trf); break; } @@ -2303,18 +2303,16 @@ static const struct dev_pm_ops trf7970a_pm_ops = { trf7970a_pm_runtime_resume, NULL) }; -static const struct of_device_id trf7970a_of_match[] __maybe_unused = { - {.compatible = "ti,trf7970a",}, - {}, +static const struct of_device_id trf7970a_of_match[] = { + { .compatible = "ti,trf7970a" }, + { } }; - MODULE_DEVICE_TABLE(of, trf7970a_of_match); static const struct spi_device_id trf7970a_id_table[] = { - {"trf7970a", 0}, - {} + { .name = "trf7970a" }, + { } }; - MODULE_DEVICE_TABLE(spi, trf7970a_id_table); static struct spi_driver trf7970a_spi_driver = {