diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2013-02-11 04:30:04 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-02-11 12:35:36 -0500 |
commit | cd48d8ba149484c4723a2b75159deeb83f3d2273 (patch) | |
tree | 354c294c7eea0af66cd72036deff5f8c6ec6d53b /drivers/nfc/microread | |
parent | 8708aac79e4572ba673d7a21e94ddca9f3abb7fc (diff) |
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>
Diffstat (limited to 'drivers/nfc/microread')
-rw-r--r-- | drivers/nfc/microread/mei.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/drivers/nfc/microread/mei.c b/drivers/nfc/microread/mei.c index c078e56d7d14..eef38cfd812e 100644 --- a/drivers/nfc/microread/mei.c +++ b/drivers/nfc/microread/mei.c | |||
@@ -48,7 +48,7 @@ struct mei_nfc_hdr { | |||
48 | #define MEI_NFC_MAX_READ (MEI_NFC_HEADER_SIZE + MEI_NFC_MAX_HCI_PAYLOAD) | 48 | #define MEI_NFC_MAX_READ (MEI_NFC_HEADER_SIZE + MEI_NFC_MAX_HCI_PAYLOAD) |
49 | 49 | ||
50 | struct microread_mei_phy { | 50 | struct microread_mei_phy { |
51 | struct mei_bus_client *client; | 51 | struct mei_device *mei_device; |
52 | struct nfc_hci_dev *hdev; | 52 | struct nfc_hci_dev *hdev; |
53 | 53 | ||
54 | int powered; | 54 | int powered; |
@@ -105,14 +105,14 @@ static int microread_mei_write(void *phy_id, struct sk_buff *skb) | |||
105 | 105 | ||
106 | MEI_DUMP_SKB_OUT("mei frame sent", skb); | 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 | if (r > 0) | 109 | if (r > 0) |
110 | r = 0; | 110 | r = 0; |
111 | 111 | ||
112 | return r; | 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 | void *context) | 116 | void *context) |
117 | { | 117 | { |
118 | struct microread_mei_phy *phy = context; | 118 | struct microread_mei_phy *phy = context; |
@@ -120,7 +120,7 @@ static void microread_event_cb(struct mei_bus_client *client, u32 events, | |||
120 | if (phy->hard_fault != 0) | 120 | if (phy->hard_fault != 0) |
121 | return; | 121 | return; |
122 | 122 | ||
123 | if (events & BIT(MEI_BUS_EVENT_RX)) { | 123 | if (events & BIT(MEI_EVENT_RX)) { |
124 | struct sk_buff *skb; | 124 | struct sk_buff *skb; |
125 | int reply_size; | 125 | int reply_size; |
126 | 126 | ||
@@ -128,7 +128,7 @@ static void microread_event_cb(struct mei_bus_client *client, u32 events, | |||
128 | if (!skb) | 128 | if (!skb) |
129 | return; | 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 | if (reply_size < MEI_NFC_HEADER_SIZE) { | 132 | if (reply_size < MEI_NFC_HEADER_SIZE) { |
133 | kfree(skb); | 133 | kfree(skb); |
134 | return; | 134 | return; |
@@ -149,7 +149,8 @@ static struct nfc_phy_ops mei_phy_ops = { | |||
149 | .disable = microread_mei_disable, | 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 | struct microread_mei_phy *phy; | 155 | struct microread_mei_phy *phy; |
155 | int r; | 156 | int r; |
@@ -162,10 +163,10 @@ static int microread_mei_probe(struct mei_bus_client *client) | |||
162 | return -ENOMEM; | 163 | return -ENOMEM; |
163 | } | 164 | } |
164 | 165 | ||
165 | phy->client = client; | 166 | phy->device = device; |
166 | mei_bus_set_clientdata(client, phy); | 167 | mei_set_clientdata(device, phy); |
167 | 168 | ||
168 | r = mei_bus_register_event_cb(client, microread_event_cb, phy); | 169 | r = mei_register_event_cb(device, microread_event_cb, phy); |
169 | if (r) { | 170 | if (r) { |
170 | pr_err(MICROREAD_DRIVER_NAME ": event cb registration failed\n"); | 171 | pr_err(MICROREAD_DRIVER_NAME ": event cb registration failed\n"); |
171 | goto err_out; | 172 | goto err_out; |
@@ -185,9 +186,9 @@ err_out: | |||
185 | return r; | 186 | return r; |
186 | } | 187 | } |
187 | 188 | ||
188 | static int microread_mei_remove(struct mei_bus_client *client) | 189 | static int microread_mei_remove(struct mei_device *device) |
189 | { | 190 | { |
190 | struct microread_mei_phy *phy = mei_bus_get_clientdata(client); | 191 | struct microread_mei_phy *phy = mei_get_clientdata(device); |
191 | 192 | ||
192 | pr_info("Removing microread\n"); | 193 | pr_info("Removing microread\n"); |
193 | 194 | ||
@@ -201,14 +202,18 @@ static int microread_mei_remove(struct mei_bus_client *client) | |||
201 | return 0; | 202 | return 0; |
202 | } | 203 | } |
203 | 204 | ||
204 | static struct mei_bus_driver microread_driver = { | 205 | static struct mei_id microread_mei_tbl[] = { |
205 | .driver = { | 206 | { MICROREAD_DRIVER_NAME, MICROREAD_UUID }, |
206 | .name = MICROREAD_DRIVER_NAME, | 207 | |
207 | }, | 208 | /* required last entry */ |
208 | .id = { | 209 | { } |
209 | .name = MICROREAD_DRIVER_NAME, | 210 | }; |
210 | .uuid = MICROREAD_UUID, | 211 | |
211 | }, | 212 | MODULE_DEVICE_TABLE(mei, microread_mei_tbl); |
213 | |||
214 | static struct mei_driver microread_driver = { | ||
215 | .id_table = microread_mei_tbl, | ||
216 | .name = MICROREAD_DRIVER_NAME, | ||
212 | 217 | ||
213 | .probe = microread_mei_probe, | 218 | .probe = microread_mei_probe, |
214 | .remove = microread_mei_remove, | 219 | .remove = microread_mei_remove, |