Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

NFC: microread: Fix mei physical layer

The MEI bus API changed according to the latest comments from the char-misc
maintainers, and this patch fixes the microread mei physical layer code
according to those changes:
We pass the MEI id back to the probe routine, and the mei_driver takes a
table of MEI ids instead of one static id.
Also, mei_bus_driver got renamed to mei_driver, mei_bus_client to
mei_device, and mei_bus_set/get_clientdata to mei_set/get_clientdata.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>

+24 -19
+24 -19
drivers/nfc/microread/mei.c
··· 48 48 #define MEI_NFC_MAX_READ (MEI_NFC_HEADER_SIZE + MEI_NFC_MAX_HCI_PAYLOAD) 49 49 50 50 struct microread_mei_phy { 51 - struct mei_bus_client *client; 51 + struct mei_device *mei_device; 52 52 struct nfc_hci_dev *hdev; 53 53 54 54 int powered; ··· 105 105 106 106 MEI_DUMP_SKB_OUT("mei frame sent", skb); 107 107 108 - r = mei_bus_send(phy->client, skb->data, skb->len); 108 + r = mei_send(phy->device, skb->data, skb->len); 109 109 if (r > 0) 110 110 r = 0; 111 111 112 112 return r; 113 113 } 114 114 115 - static void microread_event_cb(struct mei_bus_client *client, u32 events, 115 + static void microread_event_cb(struct mei_device *device, u32 events, 116 116 void *context) 117 117 { 118 118 struct microread_mei_phy *phy = context; ··· 120 120 if (phy->hard_fault != 0) 121 121 return; 122 122 123 - if (events & BIT(MEI_BUS_EVENT_RX)) { 123 + if (events & BIT(MEI_EVENT_RX)) { 124 124 struct sk_buff *skb; 125 125 int reply_size; 126 126 ··· 128 128 if (!skb) 129 129 return; 130 130 131 - reply_size = mei_bus_recv(client, skb->data, MEI_NFC_MAX_READ); 131 + reply_size = mei_recv(device, skb->data, MEI_NFC_MAX_READ); 132 132 if (reply_size < MEI_NFC_HEADER_SIZE) { 133 133 kfree(skb); 134 134 return; ··· 149 149 .disable = microread_mei_disable, 150 150 }; 151 151 152 - static int microread_mei_probe(struct mei_bus_client *client) 152 + static int microread_mei_probe(struct mei_device *device, 153 + const struct mei_id *id) 153 154 { 154 155 struct microread_mei_phy *phy; 155 156 int r; ··· 163 162 return -ENOMEM; 164 163 } 165 164 166 - phy->client = client; 167 - mei_bus_set_clientdata(client, phy); 165 + phy->device = device; 166 + mei_set_clientdata(device, phy); 168 167 169 - r = mei_bus_register_event_cb(client, microread_event_cb, phy); 168 + r = mei_register_event_cb(device, microread_event_cb, phy); 170 169 if (r) { 171 170 pr_err(MICROREAD_DRIVER_NAME ": event cb registration failed\n"); 172 171 goto err_out; ··· 186 185 return r; 187 186 } 188 187 189 - static int microread_mei_remove(struct mei_bus_client *client) 188 + static int microread_mei_remove(struct mei_device *device) 190 189 { 191 - struct microread_mei_phy *phy = mei_bus_get_clientdata(client); 190 + struct microread_mei_phy *phy = mei_get_clientdata(device); 192 191 193 192 pr_info("Removing microread\n"); 194 193 ··· 202 201 return 0; 203 202 } 204 203 205 - static struct mei_bus_driver microread_driver = { 206 - .driver = { 207 - .name = MICROREAD_DRIVER_NAME, 208 - }, 209 - .id = { 210 - .name = MICROREAD_DRIVER_NAME, 211 - .uuid = MICROREAD_UUID, 212 - }, 204 + static struct mei_id microread_mei_tbl[] = { 205 + { MICROREAD_DRIVER_NAME, MICROREAD_UUID }, 206 + 207 + /* required last entry */ 208 + { } 209 + }; 210 + 211 + MODULE_DEVICE_TABLE(mei, microread_mei_tbl); 212 + 213 + static struct mei_driver microread_driver = { 214 + .id_table = microread_mei_tbl, 215 + .name = MICROREAD_DRIVER_NAME, 213 216 214 217 .probe = microread_mei_probe, 215 218 .remove = microread_mei_remove,