diff options
| -rw-r--r-- | drivers/nfc/mei_phy.c | 30 | ||||
| -rw-r--r-- | drivers/nfc/mei_phy.h | 4 | ||||
| -rw-r--r-- | drivers/nfc/microread/mei.c | 8 | ||||
| -rw-r--r-- | drivers/nfc/pn544/mei.c | 8 | ||||
| -rw-r--r-- | include/linux/mei_cl_bus.h | 29 |
5 files changed, 39 insertions, 40 deletions
diff --git a/drivers/nfc/mei_phy.c b/drivers/nfc/mei_phy.c index 754a9bb0f58d..ecd2a0dce797 100644 --- a/drivers/nfc/mei_phy.c +++ b/drivers/nfc/mei_phy.c | |||
| @@ -118,7 +118,7 @@ static int mei_nfc_if_version(struct nfc_mei_phy *phy) | |||
| 118 | cmd.sub_command = MEI_NFC_SUBCMD_IF_VERSION; | 118 | cmd.sub_command = MEI_NFC_SUBCMD_IF_VERSION; |
| 119 | 119 | ||
| 120 | MEI_DUMP_NFC_HDR("version", &cmd.hdr); | 120 | MEI_DUMP_NFC_HDR("version", &cmd.hdr); |
| 121 | r = mei_cl_send(phy->device, (u8 *)&cmd, sizeof(struct mei_nfc_cmd)); | 121 | r = mei_cl_send(phy->cldev, (u8 *)&cmd, sizeof(struct mei_nfc_cmd)); |
| 122 | if (r < 0) { | 122 | if (r < 0) { |
| 123 | pr_err("Could not send IF version cmd\n"); | 123 | pr_err("Could not send IF version cmd\n"); |
| 124 | return r; | 124 | return r; |
| @@ -132,7 +132,7 @@ static int mei_nfc_if_version(struct nfc_mei_phy *phy) | |||
| 132 | if (!reply) | 132 | if (!reply) |
| 133 | return -ENOMEM; | 133 | return -ENOMEM; |
| 134 | 134 | ||
| 135 | bytes_recv = mei_cl_recv(phy->device, (u8 *)reply, if_version_length); | 135 | bytes_recv = mei_cl_recv(phy->cldev, (u8 *)reply, if_version_length); |
| 136 | if (bytes_recv < 0 || bytes_recv < sizeof(struct mei_nfc_reply)) { | 136 | if (bytes_recv < 0 || bytes_recv < sizeof(struct mei_nfc_reply)) { |
| 137 | pr_err("Could not read IF version\n"); | 137 | pr_err("Could not read IF version\n"); |
| 138 | r = -EIO; | 138 | r = -EIO; |
| @@ -186,13 +186,13 @@ static int mei_nfc_connect(struct nfc_mei_phy *phy) | |||
| 186 | connect->vendor_id = phy->vendor_id; | 186 | connect->vendor_id = phy->vendor_id; |
| 187 | 187 | ||
| 188 | MEI_DUMP_NFC_HDR("connect request", &cmd->hdr); | 188 | MEI_DUMP_NFC_HDR("connect request", &cmd->hdr); |
| 189 | r = mei_cl_send(phy->device, (u8 *)cmd, connect_length); | 189 | r = mei_cl_send(phy->cldev, (u8 *)cmd, connect_length); |
| 190 | if (r < 0) { | 190 | if (r < 0) { |
| 191 | pr_err("Could not send connect cmd %d\n", r); | 191 | pr_err("Could not send connect cmd %d\n", r); |
| 192 | goto err; | 192 | goto err; |
| 193 | } | 193 | } |
| 194 | 194 | ||
| 195 | bytes_recv = mei_cl_recv(phy->device, (u8 *)reply, connect_resp_length); | 195 | bytes_recv = mei_cl_recv(phy->cldev, (u8 *)reply, connect_resp_length); |
| 196 | if (bytes_recv < 0) { | 196 | if (bytes_recv < 0) { |
| 197 | r = bytes_recv; | 197 | r = bytes_recv; |
| 198 | pr_err("Could not read connect response %d\n", r); | 198 | pr_err("Could not read connect response %d\n", r); |
| @@ -238,7 +238,7 @@ static int mei_nfc_send(struct nfc_mei_phy *phy, u8 *buf, size_t length) | |||
| 238 | MEI_DUMP_NFC_HDR("send", hdr); | 238 | MEI_DUMP_NFC_HDR("send", hdr); |
| 239 | 239 | ||
| 240 | memcpy(mei_buf + MEI_NFC_HEADER_SIZE, buf, length); | 240 | memcpy(mei_buf + MEI_NFC_HEADER_SIZE, buf, length); |
| 241 | err = mei_cl_send(phy->device, mei_buf, length + MEI_NFC_HEADER_SIZE); | 241 | err = mei_cl_send(phy->cldev, mei_buf, length + MEI_NFC_HEADER_SIZE); |
| 242 | if (err < 0) | 242 | if (err < 0) |
| 243 | goto out; | 243 | goto out; |
| 244 | 244 | ||
| @@ -278,7 +278,7 @@ static int mei_nfc_recv(struct nfc_mei_phy *phy, u8 *buf, size_t length) | |||
| 278 | struct mei_nfc_hdr *hdr; | 278 | struct mei_nfc_hdr *hdr; |
| 279 | int received_length; | 279 | int received_length; |
| 280 | 280 | ||
| 281 | received_length = mei_cl_recv(phy->device, buf, length); | 281 | received_length = mei_cl_recv(phy->cldev, buf, length); |
| 282 | if (received_length < 0) | 282 | if (received_length < 0) |
| 283 | return received_length; | 283 | return received_length; |
| 284 | 284 | ||
| @@ -296,7 +296,7 @@ static int mei_nfc_recv(struct nfc_mei_phy *phy, u8 *buf, size_t length) | |||
| 296 | } | 296 | } |
| 297 | 297 | ||
| 298 | 298 | ||
| 299 | static void nfc_mei_event_cb(struct mei_cl_device *device, u32 events, | 299 | static void nfc_mei_event_cb(struct mei_cl_device *cldev, u32 events, |
| 300 | void *context) | 300 | void *context) |
| 301 | { | 301 | { |
| 302 | struct nfc_mei_phy *phy = context; | 302 | struct nfc_mei_phy *phy = context; |
| @@ -337,7 +337,7 @@ static int nfc_mei_phy_enable(void *phy_id) | |||
| 337 | if (phy->powered == 1) | 337 | if (phy->powered == 1) |
| 338 | return 0; | 338 | return 0; |
| 339 | 339 | ||
| 340 | r = mei_cl_enable_device(phy->device); | 340 | r = mei_cl_enable_device(phy->cldev); |
| 341 | if (r < 0) { | 341 | if (r < 0) { |
| 342 | pr_err("Could not enable device %d\n", r); | 342 | pr_err("Could not enable device %d\n", r); |
| 343 | return r; | 343 | return r; |
| @@ -355,7 +355,7 @@ static int nfc_mei_phy_enable(void *phy_id) | |||
| 355 | goto err; | 355 | goto err; |
| 356 | } | 356 | } |
| 357 | 357 | ||
| 358 | r = mei_cl_register_event_cb(phy->device, BIT(MEI_CL_EVENT_RX), | 358 | r = mei_cl_register_event_cb(phy->cldev, BIT(MEI_CL_EVENT_RX), |
| 359 | nfc_mei_event_cb, phy); | 359 | nfc_mei_event_cb, phy); |
| 360 | if (r) { | 360 | if (r) { |
| 361 | pr_err("Event cb registration failed %d\n", r); | 361 | pr_err("Event cb registration failed %d\n", r); |
| @@ -368,7 +368,7 @@ static int nfc_mei_phy_enable(void *phy_id) | |||
| 368 | 368 | ||
| 369 | err: | 369 | err: |
| 370 | phy->powered = 0; | 370 | phy->powered = 0; |
| 371 | mei_cl_disable_device(phy->device); | 371 | mei_cl_disable_device(phy->cldev); |
| 372 | return r; | 372 | return r; |
| 373 | } | 373 | } |
| 374 | 374 | ||
| @@ -378,7 +378,7 @@ static void nfc_mei_phy_disable(void *phy_id) | |||
| 378 | 378 | ||
| 379 | pr_info("%s\n", __func__); | 379 | pr_info("%s\n", __func__); |
| 380 | 380 | ||
| 381 | mei_cl_disable_device(phy->device); | 381 | mei_cl_disable_device(phy->cldev); |
| 382 | 382 | ||
| 383 | phy->powered = 0; | 383 | phy->powered = 0; |
| 384 | } | 384 | } |
| @@ -390,7 +390,7 @@ struct nfc_phy_ops mei_phy_ops = { | |||
| 390 | }; | 390 | }; |
| 391 | EXPORT_SYMBOL_GPL(mei_phy_ops); | 391 | EXPORT_SYMBOL_GPL(mei_phy_ops); |
| 392 | 392 | ||
| 393 | struct nfc_mei_phy *nfc_mei_phy_alloc(struct mei_cl_device *device) | 393 | struct nfc_mei_phy *nfc_mei_phy_alloc(struct mei_cl_device *cldev) |
| 394 | { | 394 | { |
| 395 | struct nfc_mei_phy *phy; | 395 | struct nfc_mei_phy *phy; |
| 396 | 396 | ||
| @@ -398,9 +398,9 @@ struct nfc_mei_phy *nfc_mei_phy_alloc(struct mei_cl_device *device) | |||
| 398 | if (!phy) | 398 | if (!phy) |
| 399 | return NULL; | 399 | return NULL; |
| 400 | 400 | ||
| 401 | phy->device = device; | 401 | phy->cldev = cldev; |
| 402 | init_waitqueue_head(&phy->send_wq); | 402 | init_waitqueue_head(&phy->send_wq); |
| 403 | mei_cl_set_drvdata(device, phy); | 403 | mei_cl_set_drvdata(cldev, phy); |
| 404 | 404 | ||
| 405 | return phy; | 405 | return phy; |
| 406 | } | 406 | } |
| @@ -408,7 +408,7 @@ EXPORT_SYMBOL_GPL(nfc_mei_phy_alloc); | |||
| 408 | 408 | ||
| 409 | void nfc_mei_phy_free(struct nfc_mei_phy *phy) | 409 | void nfc_mei_phy_free(struct nfc_mei_phy *phy) |
| 410 | { | 410 | { |
| 411 | mei_cl_disable_device(phy->device); | 411 | mei_cl_disable_device(phy->cldev); |
| 412 | kfree(phy); | 412 | kfree(phy); |
| 413 | } | 413 | } |
| 414 | EXPORT_SYMBOL_GPL(nfc_mei_phy_free); | 414 | EXPORT_SYMBOL_GPL(nfc_mei_phy_free); |
diff --git a/drivers/nfc/mei_phy.h b/drivers/nfc/mei_phy.h index fbfa3e61738f..acd3a1fc69e6 100644 --- a/drivers/nfc/mei_phy.h +++ b/drivers/nfc/mei_phy.h | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | /** | 13 | /** |
| 14 | * struct nfc_mei_phy | 14 | * struct nfc_mei_phy |
| 15 | * | 15 | * |
| 16 | * @device: mei device | 16 | * @cldev: mei client device |
| 17 | * @hdev: nfc hci device | 17 | * @hdev: nfc hci device |
| 18 | 18 | ||
| 19 | * @send_wq: send completion wait queue | 19 | * @send_wq: send completion wait queue |
| @@ -28,7 +28,7 @@ | |||
| 28 | * and prevents normal operation. | 28 | * and prevents normal operation. |
| 29 | */ | 29 | */ |
| 30 | struct nfc_mei_phy { | 30 | struct nfc_mei_phy { |
| 31 | struct mei_cl_device *device; | 31 | struct mei_cl_device *cldev; |
| 32 | struct nfc_hci_dev *hdev; | 32 | struct nfc_hci_dev *hdev; |
| 33 | 33 | ||
| 34 | wait_queue_head_t send_wq; | 34 | wait_queue_head_t send_wq; |
diff --git a/drivers/nfc/microread/mei.c b/drivers/nfc/microread/mei.c index 93328bd45110..994871c02b7b 100644 --- a/drivers/nfc/microread/mei.c +++ b/drivers/nfc/microread/mei.c | |||
| @@ -29,7 +29,7 @@ | |||
| 29 | 29 | ||
| 30 | #define MICROREAD_DRIVER_NAME "microread" | 30 | #define MICROREAD_DRIVER_NAME "microread" |
| 31 | 31 | ||
| 32 | static int microread_mei_probe(struct mei_cl_device *device, | 32 | static int microread_mei_probe(struct mei_cl_device *cldev, |
| 33 | const struct mei_cl_device_id *id) | 33 | const struct mei_cl_device_id *id) |
| 34 | { | 34 | { |
| 35 | struct nfc_mei_phy *phy; | 35 | struct nfc_mei_phy *phy; |
| @@ -37,7 +37,7 @@ static int microread_mei_probe(struct mei_cl_device *device, | |||
| 37 | 37 | ||
| 38 | pr_info("Probing NFC microread\n"); | 38 | pr_info("Probing NFC microread\n"); |
| 39 | 39 | ||
| 40 | phy = nfc_mei_phy_alloc(device); | 40 | phy = nfc_mei_phy_alloc(cldev); |
| 41 | if (!phy) { | 41 | if (!phy) { |
| 42 | pr_err("Cannot allocate memory for microread mei phy.\n"); | 42 | pr_err("Cannot allocate memory for microread mei phy.\n"); |
| 43 | return -ENOMEM; | 43 | return -ENOMEM; |
| @@ -55,9 +55,9 @@ static int microread_mei_probe(struct mei_cl_device *device, | |||
| 55 | return 0; | 55 | return 0; |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | static int microread_mei_remove(struct mei_cl_device *device) | 58 | static int microread_mei_remove(struct mei_cl_device *cldev) |
| 59 | { | 59 | { |
| 60 | struct nfc_mei_phy *phy = mei_cl_get_drvdata(device); | 60 | struct nfc_mei_phy *phy = mei_cl_get_drvdata(cldev); |
| 61 | 61 | ||
| 62 | microread_remove(phy->hdev); | 62 | microread_remove(phy->hdev); |
| 63 | 63 | ||
diff --git a/drivers/nfc/pn544/mei.c b/drivers/nfc/pn544/mei.c index 80f897b4a401..2a2c9304e64c 100644 --- a/drivers/nfc/pn544/mei.c +++ b/drivers/nfc/pn544/mei.c | |||
| @@ -27,7 +27,7 @@ | |||
| 27 | 27 | ||
| 28 | #define PN544_DRIVER_NAME "pn544" | 28 | #define PN544_DRIVER_NAME "pn544" |
| 29 | 29 | ||
| 30 | static int pn544_mei_probe(struct mei_cl_device *device, | 30 | static int pn544_mei_probe(struct mei_cl_device *cldev, |
| 31 | const struct mei_cl_device_id *id) | 31 | const struct mei_cl_device_id *id) |
| 32 | { | 32 | { |
| 33 | struct nfc_mei_phy *phy; | 33 | struct nfc_mei_phy *phy; |
| @@ -35,7 +35,7 @@ static int pn544_mei_probe(struct mei_cl_device *device, | |||
| 35 | 35 | ||
| 36 | pr_info("Probing NFC pn544\n"); | 36 | pr_info("Probing NFC pn544\n"); |
| 37 | 37 | ||
| 38 | phy = nfc_mei_phy_alloc(device); | 38 | phy = nfc_mei_phy_alloc(cldev); |
| 39 | if (!phy) { | 39 | if (!phy) { |
| 40 | pr_err("Cannot allocate memory for pn544 mei phy.\n"); | 40 | pr_err("Cannot allocate memory for pn544 mei phy.\n"); |
| 41 | return -ENOMEM; | 41 | return -ENOMEM; |
| @@ -53,9 +53,9 @@ static int pn544_mei_probe(struct mei_cl_device *device, | |||
| 53 | return 0; | 53 | return 0; |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | static int pn544_mei_remove(struct mei_cl_device *device) | 56 | static int pn544_mei_remove(struct mei_cl_device *cldev) |
| 57 | { | 57 | { |
| 58 | struct nfc_mei_phy *phy = mei_cl_get_drvdata(device); | 58 | struct nfc_mei_phy *phy = mei_cl_get_drvdata(cldev); |
| 59 | 59 | ||
| 60 | pr_info("Removing pn544\n"); | 60 | pr_info("Removing pn544\n"); |
| 61 | 61 | ||
diff --git a/include/linux/mei_cl_bus.h b/include/linux/mei_cl_bus.h index 30d1c8b94a27..c364df750405 100644 --- a/include/linux/mei_cl_bus.h +++ b/include/linux/mei_cl_bus.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | struct mei_cl_device; | 8 | struct mei_cl_device; |
| 9 | struct mei_device; | 9 | struct mei_device; |
| 10 | 10 | ||
| 11 | typedef void (*mei_cl_event_cb_t)(struct mei_cl_device *device, | 11 | typedef void (*mei_cl_event_cb_t)(struct mei_cl_device *cldev, |
| 12 | u32 events, void *context); | 12 | u32 events, void *context); |
| 13 | 13 | ||
| 14 | /** | 14 | /** |
| @@ -62,22 +62,21 @@ struct mei_cl_driver { | |||
| 62 | 62 | ||
| 63 | const struct mei_cl_device_id *id_table; | 63 | const struct mei_cl_device_id *id_table; |
| 64 | 64 | ||
| 65 | int (*probe)(struct mei_cl_device *dev, | 65 | int (*probe)(struct mei_cl_device *cldev, |
| 66 | const struct mei_cl_device_id *id); | 66 | const struct mei_cl_device_id *id); |
| 67 | int (*remove)(struct mei_cl_device *dev); | 67 | int (*remove)(struct mei_cl_device *cldev); |
| 68 | }; | 68 | }; |
| 69 | 69 | ||
| 70 | int __mei_cl_driver_register(struct mei_cl_driver *driver, | 70 | int __mei_cl_driver_register(struct mei_cl_driver *cldrv, struct module *owner); |
| 71 | struct module *owner); | 71 | #define mei_cl_driver_register(cldrv) \ |
| 72 | #define mei_cl_driver_register(driver) \ | 72 | __mei_cl_driver_register(cldrv, THIS_MODULE) |
| 73 | __mei_cl_driver_register(driver, THIS_MODULE) | ||
| 74 | 73 | ||
| 75 | void mei_cl_driver_unregister(struct mei_cl_driver *driver); | 74 | void mei_cl_driver_unregister(struct mei_cl_driver *cldrv); |
| 76 | 75 | ||
| 77 | ssize_t mei_cl_send(struct mei_cl_device *device, u8 *buf, size_t length); | 76 | ssize_t mei_cl_send(struct mei_cl_device *cldev, u8 *buf, size_t length); |
| 78 | ssize_t mei_cl_recv(struct mei_cl_device *device, u8 *buf, size_t length); | 77 | ssize_t mei_cl_recv(struct mei_cl_device *cldev, u8 *buf, size_t length); |
| 79 | 78 | ||
| 80 | int mei_cl_register_event_cb(struct mei_cl_device *device, | 79 | int mei_cl_register_event_cb(struct mei_cl_device *cldev, |
| 81 | unsigned long event_mask, | 80 | unsigned long event_mask, |
| 82 | mei_cl_event_cb_t read_cb, void *context); | 81 | mei_cl_event_cb_t read_cb, void *context); |
| 83 | 82 | ||
| @@ -88,11 +87,11 @@ int mei_cl_register_event_cb(struct mei_cl_device *device, | |||
| 88 | const uuid_le *mei_cldev_uuid(const struct mei_cl_device *cldev); | 87 | const uuid_le *mei_cldev_uuid(const struct mei_cl_device *cldev); |
| 89 | u8 mei_cldev_ver(const struct mei_cl_device *cldev); | 88 | u8 mei_cldev_ver(const struct mei_cl_device *cldev); |
| 90 | 89 | ||
| 91 | void *mei_cl_get_drvdata(const struct mei_cl_device *device); | 90 | void *mei_cl_get_drvdata(const struct mei_cl_device *cldev); |
| 92 | void mei_cl_set_drvdata(struct mei_cl_device *device, void *data); | 91 | void mei_cl_set_drvdata(struct mei_cl_device *cldev, void *data); |
| 93 | 92 | ||
| 94 | int mei_cl_enable_device(struct mei_cl_device *device); | 93 | int mei_cl_enable_device(struct mei_cl_device *cldev); |
| 95 | int mei_cl_disable_device(struct mei_cl_device *device); | 94 | int mei_cl_disable_device(struct mei_cl_device *cldev); |
| 96 | bool mei_cldev_enabled(struct mei_cl_device *cldev); | 95 | bool mei_cldev_enabled(struct mei_cl_device *cldev); |
| 97 | 96 | ||
| 98 | #endif /* _LINUX_MEI_CL_BUS_H */ | 97 | #endif /* _LINUX_MEI_CL_BUS_H */ |
