diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-10 14:02:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-10 14:02:58 -0400 |
commit | bb93109e1544e2a4d12c2c35bf1af84c25a2699d (patch) | |
tree | e60cd9bc1efbaa9500a4ae59cf4f6186eb4ef29e | |
parent | 23e3a1d971f6658de5aa423011c153765f28fe26 (diff) | |
parent | bcabcfd2e09ceb8599a33001e812e7cbad00fc4d (diff) |
Merge tag 'firewire-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394
Pull firewire updates from Stefan Richter:
"Make struct ieee1394_device_id.driver_data actually avaliable to 1394
protocol drivers. This is especially useful to 1394 audio drivers for
model-specific parameters and methods"
* tag 'firewire-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394:
firewire: remove support of fw_driver.driver.probe and .remove methods
firewire: introduce fw_driver.probe and .remove methods
-rw-r--r-- | drivers/firewire/core-device.c | 39 | ||||
-rw-r--r-- | drivers/firewire/net.c | 50 | ||||
-rw-r--r-- | drivers/firewire/sbp2.c | 17 | ||||
-rw-r--r-- | drivers/media/firewire/firedtv-fw.c | 19 | ||||
-rw-r--r-- | drivers/staging/fwserial/fwserial.c | 14 | ||||
-rw-r--r-- | include/linux/firewire.h | 2 | ||||
-rw-r--r-- | sound/firewire/isight.c | 44 | ||||
-rw-r--r-- | sound/firewire/scs1x.c | 39 | ||||
-rw-r--r-- | sound/firewire/speakers.c | 106 |
9 files changed, 160 insertions, 170 deletions
diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c index 664a6ff0a823..de4aa409abe2 100644 --- a/drivers/firewire/core-device.c +++ b/drivers/firewire/core-device.c | |||
@@ -165,25 +165,44 @@ static bool match_ids(const struct ieee1394_device_id *id_table, int *id) | |||
165 | return (match & id_table->match_flags) == id_table->match_flags; | 165 | return (match & id_table->match_flags) == id_table->match_flags; |
166 | } | 166 | } |
167 | 167 | ||
168 | static bool is_fw_unit(struct device *dev); | 168 | static const struct ieee1394_device_id *unit_match(struct device *dev, |
169 | 169 | struct device_driver *drv) | |
170 | static int fw_unit_match(struct device *dev, struct device_driver *drv) | ||
171 | { | 170 | { |
172 | const struct ieee1394_device_id *id_table = | 171 | const struct ieee1394_device_id *id_table = |
173 | container_of(drv, struct fw_driver, driver)->id_table; | 172 | container_of(drv, struct fw_driver, driver)->id_table; |
174 | int id[] = {0, 0, 0, 0}; | 173 | int id[] = {0, 0, 0, 0}; |
175 | 174 | ||
176 | /* We only allow binding to fw_units. */ | ||
177 | if (!is_fw_unit(dev)) | ||
178 | return 0; | ||
179 | |||
180 | get_modalias_ids(fw_unit(dev), id); | 175 | get_modalias_ids(fw_unit(dev), id); |
181 | 176 | ||
182 | for (; id_table->match_flags != 0; id_table++) | 177 | for (; id_table->match_flags != 0; id_table++) |
183 | if (match_ids(id_table, id)) | 178 | if (match_ids(id_table, id)) |
184 | return 1; | 179 | return id_table; |
185 | 180 | ||
186 | return 0; | 181 | return NULL; |
182 | } | ||
183 | |||
184 | static bool is_fw_unit(struct device *dev); | ||
185 | |||
186 | static int fw_unit_match(struct device *dev, struct device_driver *drv) | ||
187 | { | ||
188 | /* We only allow binding to fw_units. */ | ||
189 | return is_fw_unit(dev) && unit_match(dev, drv) != NULL; | ||
190 | } | ||
191 | |||
192 | static int fw_unit_probe(struct device *dev) | ||
193 | { | ||
194 | struct fw_driver *driver = | ||
195 | container_of(dev->driver, struct fw_driver, driver); | ||
196 | |||
197 | return driver->probe(fw_unit(dev), unit_match(dev, dev->driver)); | ||
198 | } | ||
199 | |||
200 | static int fw_unit_remove(struct device *dev) | ||
201 | { | ||
202 | struct fw_driver *driver = | ||
203 | container_of(dev->driver, struct fw_driver, driver); | ||
204 | |||
205 | return driver->remove(fw_unit(dev)), 0; | ||
187 | } | 206 | } |
188 | 207 | ||
189 | static int get_modalias(struct fw_unit *unit, char *buffer, size_t buffer_size) | 208 | static int get_modalias(struct fw_unit *unit, char *buffer, size_t buffer_size) |
@@ -213,6 +232,8 @@ static int fw_unit_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
213 | struct bus_type fw_bus_type = { | 232 | struct bus_type fw_bus_type = { |
214 | .name = "firewire", | 233 | .name = "firewire", |
215 | .match = fw_unit_match, | 234 | .match = fw_unit_match, |
235 | .probe = fw_unit_probe, | ||
236 | .remove = fw_unit_remove, | ||
216 | }; | 237 | }; |
217 | EXPORT_SYMBOL(fw_bus_type); | 238 | EXPORT_SYMBOL(fw_bus_type); |
218 | 239 | ||
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c index 815b0fcbe918..6b895986dc22 100644 --- a/drivers/firewire/net.c +++ b/drivers/firewire/net.c | |||
@@ -1440,9 +1440,9 @@ static int fwnet_add_peer(struct fwnet_device *dev, | |||
1440 | return 0; | 1440 | return 0; |
1441 | } | 1441 | } |
1442 | 1442 | ||
1443 | static int fwnet_probe(struct device *_dev) | 1443 | static int fwnet_probe(struct fw_unit *unit, |
1444 | const struct ieee1394_device_id *id) | ||
1444 | { | 1445 | { |
1445 | struct fw_unit *unit = fw_unit(_dev); | ||
1446 | struct fw_device *device = fw_parent_device(unit); | 1446 | struct fw_device *device = fw_parent_device(unit); |
1447 | struct fw_card *card = device->card; | 1447 | struct fw_card *card = device->card; |
1448 | struct net_device *net; | 1448 | struct net_device *net; |
@@ -1526,6 +1526,24 @@ static int fwnet_probe(struct device *_dev) | |||
1526 | return ret; | 1526 | return ret; |
1527 | } | 1527 | } |
1528 | 1528 | ||
1529 | /* | ||
1530 | * FIXME abort partially sent fragmented datagrams, | ||
1531 | * discard partially received fragmented datagrams | ||
1532 | */ | ||
1533 | static void fwnet_update(struct fw_unit *unit) | ||
1534 | { | ||
1535 | struct fw_device *device = fw_parent_device(unit); | ||
1536 | struct fwnet_peer *peer = dev_get_drvdata(&unit->device); | ||
1537 | int generation; | ||
1538 | |||
1539 | generation = device->generation; | ||
1540 | |||
1541 | spin_lock_irq(&peer->dev->lock); | ||
1542 | peer->node_id = device->node_id; | ||
1543 | peer->generation = generation; | ||
1544 | spin_unlock_irq(&peer->dev->lock); | ||
1545 | } | ||
1546 | |||
1529 | static void fwnet_remove_peer(struct fwnet_peer *peer, struct fwnet_device *dev) | 1547 | static void fwnet_remove_peer(struct fwnet_peer *peer, struct fwnet_device *dev) |
1530 | { | 1548 | { |
1531 | struct fwnet_partial_datagram *pd, *pd_next; | 1549 | struct fwnet_partial_datagram *pd, *pd_next; |
@@ -1542,9 +1560,9 @@ static void fwnet_remove_peer(struct fwnet_peer *peer, struct fwnet_device *dev) | |||
1542 | kfree(peer); | 1560 | kfree(peer); |
1543 | } | 1561 | } |
1544 | 1562 | ||
1545 | static int fwnet_remove(struct device *_dev) | 1563 | static void fwnet_remove(struct fw_unit *unit) |
1546 | { | 1564 | { |
1547 | struct fwnet_peer *peer = dev_get_drvdata(_dev); | 1565 | struct fwnet_peer *peer = dev_get_drvdata(&unit->device); |
1548 | struct fwnet_device *dev = peer->dev; | 1566 | struct fwnet_device *dev = peer->dev; |
1549 | struct net_device *net; | 1567 | struct net_device *net; |
1550 | int i; | 1568 | int i; |
@@ -1569,26 +1587,6 @@ static int fwnet_remove(struct device *_dev) | |||
1569 | } | 1587 | } |
1570 | 1588 | ||
1571 | mutex_unlock(&fwnet_device_mutex); | 1589 | mutex_unlock(&fwnet_device_mutex); |
1572 | |||
1573 | return 0; | ||
1574 | } | ||
1575 | |||
1576 | /* | ||
1577 | * FIXME abort partially sent fragmented datagrams, | ||
1578 | * discard partially received fragmented datagrams | ||
1579 | */ | ||
1580 | static void fwnet_update(struct fw_unit *unit) | ||
1581 | { | ||
1582 | struct fw_device *device = fw_parent_device(unit); | ||
1583 | struct fwnet_peer *peer = dev_get_drvdata(&unit->device); | ||
1584 | int generation; | ||
1585 | |||
1586 | generation = device->generation; | ||
1587 | |||
1588 | spin_lock_irq(&peer->dev->lock); | ||
1589 | peer->node_id = device->node_id; | ||
1590 | peer->generation = generation; | ||
1591 | spin_unlock_irq(&peer->dev->lock); | ||
1592 | } | 1590 | } |
1593 | 1591 | ||
1594 | static const struct ieee1394_device_id fwnet_id_table[] = { | 1592 | static const struct ieee1394_device_id fwnet_id_table[] = { |
@@ -1614,10 +1612,10 @@ static struct fw_driver fwnet_driver = { | |||
1614 | .owner = THIS_MODULE, | 1612 | .owner = THIS_MODULE, |
1615 | .name = KBUILD_MODNAME, | 1613 | .name = KBUILD_MODNAME, |
1616 | .bus = &fw_bus_type, | 1614 | .bus = &fw_bus_type, |
1617 | .probe = fwnet_probe, | ||
1618 | .remove = fwnet_remove, | ||
1619 | }, | 1615 | }, |
1616 | .probe = fwnet_probe, | ||
1620 | .update = fwnet_update, | 1617 | .update = fwnet_update, |
1618 | .remove = fwnet_remove, | ||
1621 | .id_table = fwnet_id_table, | 1619 | .id_table = fwnet_id_table, |
1622 | }; | 1620 | }; |
1623 | 1621 | ||
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c index 47674b913843..281029daf98c 100644 --- a/drivers/firewire/sbp2.c +++ b/drivers/firewire/sbp2.c | |||
@@ -1128,11 +1128,10 @@ static void sbp2_init_workarounds(struct sbp2_target *tgt, u32 model, | |||
1128 | } | 1128 | } |
1129 | 1129 | ||
1130 | static struct scsi_host_template scsi_driver_template; | 1130 | static struct scsi_host_template scsi_driver_template; |
1131 | static int sbp2_remove(struct device *dev); | 1131 | static void sbp2_remove(struct fw_unit *unit); |
1132 | 1132 | ||
1133 | static int sbp2_probe(struct device *dev) | 1133 | static int sbp2_probe(struct fw_unit *unit, const struct ieee1394_device_id *id) |
1134 | { | 1134 | { |
1135 | struct fw_unit *unit = fw_unit(dev); | ||
1136 | struct fw_device *device = fw_parent_device(unit); | 1135 | struct fw_device *device = fw_parent_device(unit); |
1137 | struct sbp2_target *tgt; | 1136 | struct sbp2_target *tgt; |
1138 | struct sbp2_logical_unit *lu; | 1137 | struct sbp2_logical_unit *lu; |
@@ -1196,7 +1195,7 @@ static int sbp2_probe(struct device *dev) | |||
1196 | return 0; | 1195 | return 0; |
1197 | 1196 | ||
1198 | fail_remove: | 1197 | fail_remove: |
1199 | sbp2_remove(dev); | 1198 | sbp2_remove(unit); |
1200 | return -ENOMEM; | 1199 | return -ENOMEM; |
1201 | 1200 | ||
1202 | fail_shost_put: | 1201 | fail_shost_put: |
@@ -1222,9 +1221,8 @@ static void sbp2_update(struct fw_unit *unit) | |||
1222 | } | 1221 | } |
1223 | } | 1222 | } |
1224 | 1223 | ||
1225 | static int sbp2_remove(struct device *dev) | 1224 | static void sbp2_remove(struct fw_unit *unit) |
1226 | { | 1225 | { |
1227 | struct fw_unit *unit = fw_unit(dev); | ||
1228 | struct fw_device *device = fw_parent_device(unit); | 1226 | struct fw_device *device = fw_parent_device(unit); |
1229 | struct sbp2_target *tgt = dev_get_drvdata(&unit->device); | 1227 | struct sbp2_target *tgt = dev_get_drvdata(&unit->device); |
1230 | struct sbp2_logical_unit *lu, *next; | 1228 | struct sbp2_logical_unit *lu, *next; |
@@ -1261,10 +1259,9 @@ static int sbp2_remove(struct device *dev) | |||
1261 | kfree(lu); | 1259 | kfree(lu); |
1262 | } | 1260 | } |
1263 | scsi_remove_host(shost); | 1261 | scsi_remove_host(shost); |
1264 | dev_notice(dev, "released target %d:0:0\n", shost->host_no); | 1262 | dev_notice(&unit->device, "released target %d:0:0\n", shost->host_no); |
1265 | 1263 | ||
1266 | scsi_host_put(shost); | 1264 | scsi_host_put(shost); |
1267 | return 0; | ||
1268 | } | 1265 | } |
1269 | 1266 | ||
1270 | #define SBP2_UNIT_SPEC_ID_ENTRY 0x0000609e | 1267 | #define SBP2_UNIT_SPEC_ID_ENTRY 0x0000609e |
@@ -1285,10 +1282,10 @@ static struct fw_driver sbp2_driver = { | |||
1285 | .owner = THIS_MODULE, | 1282 | .owner = THIS_MODULE, |
1286 | .name = KBUILD_MODNAME, | 1283 | .name = KBUILD_MODNAME, |
1287 | .bus = &fw_bus_type, | 1284 | .bus = &fw_bus_type, |
1288 | .probe = sbp2_probe, | ||
1289 | .remove = sbp2_remove, | ||
1290 | }, | 1285 | }, |
1286 | .probe = sbp2_probe, | ||
1291 | .update = sbp2_update, | 1287 | .update = sbp2_update, |
1288 | .remove = sbp2_remove, | ||
1292 | .id_table = sbp2_id_table, | 1289 | .id_table = sbp2_id_table, |
1293 | }; | 1290 | }; |
1294 | 1291 | ||
diff --git a/drivers/media/firewire/firedtv-fw.c b/drivers/media/firewire/firedtv-fw.c index e24ec539a5fd..247f0e7cb5f7 100644 --- a/drivers/media/firewire/firedtv-fw.c +++ b/drivers/media/firewire/firedtv-fw.c | |||
@@ -248,7 +248,7 @@ static const char * const model_names[] = { | |||
248 | /* Adjust the template string if models with longer names appear. */ | 248 | /* Adjust the template string if models with longer names appear. */ |
249 | #define MAX_MODEL_NAME_LEN sizeof("FireDTV ????") | 249 | #define MAX_MODEL_NAME_LEN sizeof("FireDTV ????") |
250 | 250 | ||
251 | static int node_probe(struct device *dev) | 251 | static int node_probe(struct fw_unit *unit, const struct ieee1394_device_id *id) |
252 | { | 252 | { |
253 | struct firedtv *fdtv; | 253 | struct firedtv *fdtv; |
254 | char name[MAX_MODEL_NAME_LEN]; | 254 | char name[MAX_MODEL_NAME_LEN]; |
@@ -258,8 +258,8 @@ static int node_probe(struct device *dev) | |||
258 | if (!fdtv) | 258 | if (!fdtv) |
259 | return -ENOMEM; | 259 | return -ENOMEM; |
260 | 260 | ||
261 | dev_set_drvdata(dev, fdtv); | 261 | dev_set_drvdata(&unit->device, fdtv); |
262 | fdtv->device = dev; | 262 | fdtv->device = &unit->device; |
263 | fdtv->isochannel = -1; | 263 | fdtv->isochannel = -1; |
264 | fdtv->voltage = 0xff; | 264 | fdtv->voltage = 0xff; |
265 | fdtv->tone = 0xff; | 265 | fdtv->tone = 0xff; |
@@ -269,7 +269,7 @@ static int node_probe(struct device *dev) | |||
269 | mutex_init(&fdtv->demux_mutex); | 269 | mutex_init(&fdtv->demux_mutex); |
270 | INIT_WORK(&fdtv->remote_ctrl_work, avc_remote_ctrl_work); | 270 | INIT_WORK(&fdtv->remote_ctrl_work, avc_remote_ctrl_work); |
271 | 271 | ||
272 | name_len = fw_csr_string(fw_unit(dev)->directory, CSR_MODEL, | 272 | name_len = fw_csr_string(unit->directory, CSR_MODEL, |
273 | name, sizeof(name)); | 273 | name, sizeof(name)); |
274 | for (i = ARRAY_SIZE(model_names); --i; ) | 274 | for (i = ARRAY_SIZE(model_names); --i; ) |
275 | if (strlen(model_names[i]) <= name_len && | 275 | if (strlen(model_names[i]) <= name_len && |
@@ -277,7 +277,7 @@ static int node_probe(struct device *dev) | |||
277 | break; | 277 | break; |
278 | fdtv->type = i; | 278 | fdtv->type = i; |
279 | 279 | ||
280 | err = fdtv_register_rc(fdtv, dev); | 280 | err = fdtv_register_rc(fdtv, &unit->device); |
281 | if (err) | 281 | if (err) |
282 | goto fail_free; | 282 | goto fail_free; |
283 | 283 | ||
@@ -307,9 +307,9 @@ fail_free: | |||
307 | return err; | 307 | return err; |
308 | } | 308 | } |
309 | 309 | ||
310 | static int node_remove(struct device *dev) | 310 | static void node_remove(struct fw_unit *unit) |
311 | { | 311 | { |
312 | struct firedtv *fdtv = dev_get_drvdata(dev); | 312 | struct firedtv *fdtv = dev_get_drvdata(&unit->device); |
313 | 313 | ||
314 | fdtv_dvb_unregister(fdtv); | 314 | fdtv_dvb_unregister(fdtv); |
315 | 315 | ||
@@ -320,7 +320,6 @@ static int node_remove(struct device *dev) | |||
320 | fdtv_unregister_rc(fdtv); | 320 | fdtv_unregister_rc(fdtv); |
321 | 321 | ||
322 | kfree(fdtv); | 322 | kfree(fdtv); |
323 | return 0; | ||
324 | } | 323 | } |
325 | 324 | ||
326 | static void node_update(struct fw_unit *unit) | 325 | static void node_update(struct fw_unit *unit) |
@@ -391,10 +390,10 @@ static struct fw_driver fdtv_driver = { | |||
391 | .owner = THIS_MODULE, | 390 | .owner = THIS_MODULE, |
392 | .name = "firedtv", | 391 | .name = "firedtv", |
393 | .bus = &fw_bus_type, | 392 | .bus = &fw_bus_type, |
394 | .probe = node_probe, | ||
395 | .remove = node_remove, | ||
396 | }, | 393 | }, |
394 | .probe = node_probe, | ||
397 | .update = node_update, | 395 | .update = node_update, |
396 | .remove = node_remove, | ||
398 | .id_table = fdtv_id_table, | 397 | .id_table = fdtv_id_table, |
399 | }; | 398 | }; |
400 | 399 | ||
diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c index 4e1cd5e9ea37..ff92f34e4746 100644 --- a/drivers/staging/fwserial/fwserial.c +++ b/drivers/staging/fwserial/fwserial.c | |||
@@ -2446,9 +2446,9 @@ free_ports: | |||
2446 | * last peer for a given fw_card triggering the destruction of the same | 2446 | * last peer for a given fw_card triggering the destruction of the same |
2447 | * fw_serial for the same fw_card. | 2447 | * fw_serial for the same fw_card. |
2448 | */ | 2448 | */ |
2449 | static int fwserial_probe(struct device *dev) | 2449 | static int fwserial_probe(struct fw_unit *unit, |
2450 | const struct ieee1394_device_id *id) | ||
2450 | { | 2451 | { |
2451 | struct fw_unit *unit = fw_unit(dev); | ||
2452 | struct fw_serial *serial; | 2452 | struct fw_serial *serial; |
2453 | int err; | 2453 | int err; |
2454 | 2454 | ||
@@ -2470,9 +2470,9 @@ static int fwserial_probe(struct device *dev) | |||
2470 | * specific fw_card). If this is the last peer being removed, then trigger | 2470 | * specific fw_card). If this is the last peer being removed, then trigger |
2471 | * the destruction of the underlying TTYs. | 2471 | * the destruction of the underlying TTYs. |
2472 | */ | 2472 | */ |
2473 | static int fwserial_remove(struct device *dev) | 2473 | static void fwserial_remove(struct fw_unit *unit) |
2474 | { | 2474 | { |
2475 | struct fwtty_peer *peer = dev_get_drvdata(dev); | 2475 | struct fwtty_peer *peer = dev_get_drvdata(&unit->device); |
2476 | struct fw_serial *serial = peer->serial; | 2476 | struct fw_serial *serial = peer->serial; |
2477 | int i; | 2477 | int i; |
2478 | 2478 | ||
@@ -2492,8 +2492,6 @@ static int fwserial_remove(struct device *dev) | |||
2492 | kref_put(&serial->kref, fwserial_destroy); | 2492 | kref_put(&serial->kref, fwserial_destroy); |
2493 | } | 2493 | } |
2494 | mutex_unlock(&fwserial_list_mutex); | 2494 | mutex_unlock(&fwserial_list_mutex); |
2495 | |||
2496 | return 0; | ||
2497 | } | 2495 | } |
2498 | 2496 | ||
2499 | /** | 2497 | /** |
@@ -2538,10 +2536,10 @@ static struct fw_driver fwserial_driver = { | |||
2538 | .owner = THIS_MODULE, | 2536 | .owner = THIS_MODULE, |
2539 | .name = KBUILD_MODNAME, | 2537 | .name = KBUILD_MODNAME, |
2540 | .bus = &fw_bus_type, | 2538 | .bus = &fw_bus_type, |
2541 | .probe = fwserial_probe, | ||
2542 | .remove = fwserial_remove, | ||
2543 | }, | 2539 | }, |
2540 | .probe = fwserial_probe, | ||
2544 | .update = fwserial_update, | 2541 | .update = fwserial_update, |
2542 | .remove = fwserial_remove, | ||
2545 | .id_table = fwserial_id_table, | 2543 | .id_table = fwserial_id_table, |
2546 | }; | 2544 | }; |
2547 | 2545 | ||
diff --git a/include/linux/firewire.h b/include/linux/firewire.h index 191501afd7fb..3b0e820375ab 100644 --- a/include/linux/firewire.h +++ b/include/linux/firewire.h | |||
@@ -251,8 +251,10 @@ struct ieee1394_device_id; | |||
251 | 251 | ||
252 | struct fw_driver { | 252 | struct fw_driver { |
253 | struct device_driver driver; | 253 | struct device_driver driver; |
254 | int (*probe)(struct fw_unit *unit, const struct ieee1394_device_id *id); | ||
254 | /* Called when the parent device sits through a bus reset. */ | 255 | /* Called when the parent device sits through a bus reset. */ |
255 | void (*update)(struct fw_unit *unit); | 256 | void (*update)(struct fw_unit *unit); |
257 | void (*remove)(struct fw_unit *unit); | ||
256 | const struct ieee1394_device_id *id_table; | 258 | const struct ieee1394_device_id *id_table; |
257 | }; | 259 | }; |
258 | 260 | ||
diff --git a/sound/firewire/isight.c b/sound/firewire/isight.c index d428ffede4f3..58a5afefdc69 100644 --- a/sound/firewire/isight.c +++ b/sound/firewire/isight.c | |||
@@ -626,9 +626,9 @@ static u64 get_unit_base(struct fw_unit *unit) | |||
626 | return 0; | 626 | return 0; |
627 | } | 627 | } |
628 | 628 | ||
629 | static int isight_probe(struct device *unit_dev) | 629 | static int isight_probe(struct fw_unit *unit, |
630 | const struct ieee1394_device_id *id) | ||
630 | { | 631 | { |
631 | struct fw_unit *unit = fw_unit(unit_dev); | ||
632 | struct fw_device *fw_dev = fw_parent_device(unit); | 632 | struct fw_device *fw_dev = fw_parent_device(unit); |
633 | struct snd_card *card; | 633 | struct snd_card *card; |
634 | struct isight *isight; | 634 | struct isight *isight; |
@@ -637,7 +637,7 @@ static int isight_probe(struct device *unit_dev) | |||
637 | err = snd_card_create(-1, NULL, THIS_MODULE, sizeof(*isight), &card); | 637 | err = snd_card_create(-1, NULL, THIS_MODULE, sizeof(*isight), &card); |
638 | if (err < 0) | 638 | if (err < 0) |
639 | return err; | 639 | return err; |
640 | snd_card_set_dev(card, unit_dev); | 640 | snd_card_set_dev(card, &unit->device); |
641 | 641 | ||
642 | isight = card->private_data; | 642 | isight = card->private_data; |
643 | isight->card = card; | 643 | isight->card = card; |
@@ -674,7 +674,7 @@ static int isight_probe(struct device *unit_dev) | |||
674 | if (err < 0) | 674 | if (err < 0) |
675 | goto error; | 675 | goto error; |
676 | 676 | ||
677 | dev_set_drvdata(unit_dev, isight); | 677 | dev_set_drvdata(&unit->device, isight); |
678 | 678 | ||
679 | return 0; | 679 | return 0; |
680 | 680 | ||
@@ -686,23 +686,6 @@ error: | |||
686 | return err; | 686 | return err; |
687 | } | 687 | } |
688 | 688 | ||
689 | static int isight_remove(struct device *dev) | ||
690 | { | ||
691 | struct isight *isight = dev_get_drvdata(dev); | ||
692 | |||
693 | isight_pcm_abort(isight); | ||
694 | |||
695 | snd_card_disconnect(isight->card); | ||
696 | |||
697 | mutex_lock(&isight->mutex); | ||
698 | isight_stop_streaming(isight); | ||
699 | mutex_unlock(&isight->mutex); | ||
700 | |||
701 | snd_card_free_when_closed(isight->card); | ||
702 | |||
703 | return 0; | ||
704 | } | ||
705 | |||
706 | static void isight_bus_reset(struct fw_unit *unit) | 689 | static void isight_bus_reset(struct fw_unit *unit) |
707 | { | 690 | { |
708 | struct isight *isight = dev_get_drvdata(&unit->device); | 691 | struct isight *isight = dev_get_drvdata(&unit->device); |
@@ -716,6 +699,21 @@ static void isight_bus_reset(struct fw_unit *unit) | |||
716 | } | 699 | } |
717 | } | 700 | } |
718 | 701 | ||
702 | static void isight_remove(struct fw_unit *unit) | ||
703 | { | ||
704 | struct isight *isight = dev_get_drvdata(&unit->device); | ||
705 | |||
706 | isight_pcm_abort(isight); | ||
707 | |||
708 | snd_card_disconnect(isight->card); | ||
709 | |||
710 | mutex_lock(&isight->mutex); | ||
711 | isight_stop_streaming(isight); | ||
712 | mutex_unlock(&isight->mutex); | ||
713 | |||
714 | snd_card_free_when_closed(isight->card); | ||
715 | } | ||
716 | |||
719 | static const struct ieee1394_device_id isight_id_table[] = { | 717 | static const struct ieee1394_device_id isight_id_table[] = { |
720 | { | 718 | { |
721 | .match_flags = IEEE1394_MATCH_SPECIFIER_ID | | 719 | .match_flags = IEEE1394_MATCH_SPECIFIER_ID | |
@@ -732,10 +730,10 @@ static struct fw_driver isight_driver = { | |||
732 | .owner = THIS_MODULE, | 730 | .owner = THIS_MODULE, |
733 | .name = KBUILD_MODNAME, | 731 | .name = KBUILD_MODNAME, |
734 | .bus = &fw_bus_type, | 732 | .bus = &fw_bus_type, |
735 | .probe = isight_probe, | ||
736 | .remove = isight_remove, | ||
737 | }, | 733 | }, |
734 | .probe = isight_probe, | ||
738 | .update = isight_bus_reset, | 735 | .update = isight_bus_reset, |
736 | .remove = isight_remove, | ||
739 | .id_table = isight_id_table, | 737 | .id_table = isight_id_table, |
740 | }; | 738 | }; |
741 | 739 | ||
diff --git a/sound/firewire/scs1x.c b/sound/firewire/scs1x.c index b252c21b6d13..505fc8123199 100644 --- a/sound/firewire/scs1x.c +++ b/sound/firewire/scs1x.c | |||
@@ -384,9 +384,8 @@ static void scs_card_free(struct snd_card *card) | |||
384 | kfree(scs->buffer); | 384 | kfree(scs->buffer); |
385 | } | 385 | } |
386 | 386 | ||
387 | static int scs_probe(struct device *unit_dev) | 387 | static int scs_probe(struct fw_unit *unit, const struct ieee1394_device_id *id) |
388 | { | 388 | { |
389 | struct fw_unit *unit = fw_unit(unit_dev); | ||
390 | struct fw_device *fw_dev = fw_parent_device(unit); | 389 | struct fw_device *fw_dev = fw_parent_device(unit); |
391 | struct snd_card *card; | 390 | struct snd_card *card; |
392 | struct scs *scs; | 391 | struct scs *scs; |
@@ -395,7 +394,7 @@ static int scs_probe(struct device *unit_dev) | |||
395 | err = snd_card_create(-16, NULL, THIS_MODULE, sizeof(*scs), &card); | 394 | err = snd_card_create(-16, NULL, THIS_MODULE, sizeof(*scs), &card); |
396 | if (err < 0) | 395 | if (err < 0) |
397 | return err; | 396 | return err; |
398 | snd_card_set_dev(card, unit_dev); | 397 | snd_card_set_dev(card, &unit->device); |
399 | 398 | ||
400 | scs = card->private_data; | 399 | scs = card->private_data; |
401 | scs->card = card; | 400 | scs->card = card; |
@@ -442,7 +441,7 @@ static int scs_probe(struct device *unit_dev) | |||
442 | if (err < 0) | 441 | if (err < 0) |
443 | goto err_card; | 442 | goto err_card; |
444 | 443 | ||
445 | dev_set_drvdata(unit_dev, scs); | 444 | dev_set_drvdata(&unit->device, scs); |
446 | 445 | ||
447 | return 0; | 446 | return 0; |
448 | 447 | ||
@@ -453,9 +452,20 @@ err_card: | |||
453 | return err; | 452 | return err; |
454 | } | 453 | } |
455 | 454 | ||
456 | static int scs_remove(struct device *dev) | 455 | static void scs_update(struct fw_unit *unit) |
457 | { | 456 | { |
458 | struct scs *scs = dev_get_drvdata(dev); | 457 | struct scs *scs = dev_get_drvdata(&unit->device); |
458 | __be64 data; | ||
459 | |||
460 | data = cpu_to_be64(((u64)HSS1394_TAG_CHANGE_ADDRESS << 56) | | ||
461 | scs->hss_handler.offset); | ||
462 | snd_fw_transaction(scs->unit, TCODE_WRITE_BLOCK_REQUEST, | ||
463 | HSS1394_ADDRESS, &data, 8); | ||
464 | } | ||
465 | |||
466 | static void scs_remove(struct fw_unit *unit) | ||
467 | { | ||
468 | struct scs *scs = dev_get_drvdata(&unit->device); | ||
459 | 469 | ||
460 | snd_card_disconnect(scs->card); | 470 | snd_card_disconnect(scs->card); |
461 | 471 | ||
@@ -467,19 +477,6 @@ static int scs_remove(struct device *dev) | |||
467 | tasklet_kill(&scs->tasklet); | 477 | tasklet_kill(&scs->tasklet); |
468 | 478 | ||
469 | snd_card_free_when_closed(scs->card); | 479 | snd_card_free_when_closed(scs->card); |
470 | |||
471 | return 0; | ||
472 | } | ||
473 | |||
474 | static void scs_update(struct fw_unit *unit) | ||
475 | { | ||
476 | struct scs *scs = dev_get_drvdata(&unit->device); | ||
477 | __be64 data; | ||
478 | |||
479 | data = cpu_to_be64(((u64)HSS1394_TAG_CHANGE_ADDRESS << 56) | | ||
480 | scs->hss_handler.offset); | ||
481 | snd_fw_transaction(scs->unit, TCODE_WRITE_BLOCK_REQUEST, | ||
482 | HSS1394_ADDRESS, &data, 8); | ||
483 | } | 480 | } |
484 | 481 | ||
485 | static const struct ieee1394_device_id scs_id_table[] = { | 482 | static const struct ieee1394_device_id scs_id_table[] = { |
@@ -508,10 +505,10 @@ static struct fw_driver scs_driver = { | |||
508 | .owner = THIS_MODULE, | 505 | .owner = THIS_MODULE, |
509 | .name = KBUILD_MODNAME, | 506 | .name = KBUILD_MODNAME, |
510 | .bus = &fw_bus_type, | 507 | .bus = &fw_bus_type, |
511 | .probe = scs_probe, | ||
512 | .remove = scs_remove, | ||
513 | }, | 508 | }, |
509 | .probe = scs_probe, | ||
514 | .update = scs_update, | 510 | .update = scs_update, |
511 | .remove = scs_remove, | ||
515 | .id_table = scs_id_table, | 512 | .id_table = scs_id_table, |
516 | }; | 513 | }; |
517 | 514 | ||
diff --git a/sound/firewire/speakers.c b/sound/firewire/speakers.c index d6846557f270..2c6386503940 100644 --- a/sound/firewire/speakers.c +++ b/sound/firewire/speakers.c | |||
@@ -663,45 +663,9 @@ static void fwspk_card_free(struct snd_card *card) | |||
663 | mutex_destroy(&fwspk->mutex); | 663 | mutex_destroy(&fwspk->mutex); |
664 | } | 664 | } |
665 | 665 | ||
666 | static const struct device_info *fwspk_detect(struct fw_device *dev) | 666 | static int fwspk_probe(struct fw_unit *unit, |
667 | const struct ieee1394_device_id *id) | ||
667 | { | 668 | { |
668 | static const struct device_info griffin_firewave = { | ||
669 | .driver_name = "FireWave", | ||
670 | .short_name = "FireWave", | ||
671 | .long_name = "Griffin FireWave Surround", | ||
672 | .pcm_constraints = firewave_constraints, | ||
673 | .mixer_channels = 6, | ||
674 | .mute_fb_id = 0x01, | ||
675 | .volume_fb_id = 0x02, | ||
676 | }; | ||
677 | static const struct device_info lacie_speakers = { | ||
678 | .driver_name = "FWSpeakers", | ||
679 | .short_name = "FireWire Speakers", | ||
680 | .long_name = "LaCie FireWire Speakers", | ||
681 | .pcm_constraints = lacie_speakers_constraints, | ||
682 | .mixer_channels = 1, | ||
683 | .mute_fb_id = 0x01, | ||
684 | .volume_fb_id = 0x01, | ||
685 | }; | ||
686 | struct fw_csr_iterator i; | ||
687 | int key, value; | ||
688 | |||
689 | fw_csr_iterator_init(&i, dev->config_rom); | ||
690 | while (fw_csr_iterator_next(&i, &key, &value)) | ||
691 | if (key == CSR_VENDOR) | ||
692 | switch (value) { | ||
693 | case VENDOR_GRIFFIN: | ||
694 | return &griffin_firewave; | ||
695 | case VENDOR_LACIE: | ||
696 | return &lacie_speakers; | ||
697 | } | ||
698 | |||
699 | return NULL; | ||
700 | } | ||
701 | |||
702 | static int fwspk_probe(struct device *unit_dev) | ||
703 | { | ||
704 | struct fw_unit *unit = fw_unit(unit_dev); | ||
705 | struct fw_device *fw_dev = fw_parent_device(unit); | 669 | struct fw_device *fw_dev = fw_parent_device(unit); |
706 | struct snd_card *card; | 670 | struct snd_card *card; |
707 | struct fwspk *fwspk; | 671 | struct fwspk *fwspk; |
@@ -711,17 +675,13 @@ static int fwspk_probe(struct device *unit_dev) | |||
711 | err = snd_card_create(-1, NULL, THIS_MODULE, sizeof(*fwspk), &card); | 675 | err = snd_card_create(-1, NULL, THIS_MODULE, sizeof(*fwspk), &card); |
712 | if (err < 0) | 676 | if (err < 0) |
713 | return err; | 677 | return err; |
714 | snd_card_set_dev(card, unit_dev); | 678 | snd_card_set_dev(card, &unit->device); |
715 | 679 | ||
716 | fwspk = card->private_data; | 680 | fwspk = card->private_data; |
717 | fwspk->card = card; | 681 | fwspk->card = card; |
718 | mutex_init(&fwspk->mutex); | 682 | mutex_init(&fwspk->mutex); |
719 | fwspk->unit = fw_unit_get(unit); | 683 | fwspk->unit = fw_unit_get(unit); |
720 | fwspk->device_info = fwspk_detect(fw_dev); | 684 | fwspk->device_info = (const struct device_info *)id->driver_data; |
721 | if (!fwspk->device_info) { | ||
722 | err = -ENODEV; | ||
723 | goto err_unit; | ||
724 | } | ||
725 | 685 | ||
726 | err = cmp_connection_init(&fwspk->connection, unit, 0); | 686 | err = cmp_connection_init(&fwspk->connection, unit, 0); |
727 | if (err < 0) | 687 | if (err < 0) |
@@ -756,7 +716,7 @@ static int fwspk_probe(struct device *unit_dev) | |||
756 | if (err < 0) | 716 | if (err < 0) |
757 | goto error; | 717 | goto error; |
758 | 718 | ||
759 | dev_set_drvdata(unit_dev, fwspk); | 719 | dev_set_drvdata(&unit->device, fwspk); |
760 | 720 | ||
761 | return 0; | 721 | return 0; |
762 | 722 | ||
@@ -770,22 +730,6 @@ error: | |||
770 | return err; | 730 | return err; |
771 | } | 731 | } |
772 | 732 | ||
773 | static int fwspk_remove(struct device *dev) | ||
774 | { | ||
775 | struct fwspk *fwspk = dev_get_drvdata(dev); | ||
776 | |||
777 | amdtp_out_stream_pcm_abort(&fwspk->stream); | ||
778 | snd_card_disconnect(fwspk->card); | ||
779 | |||
780 | mutex_lock(&fwspk->mutex); | ||
781 | fwspk_stop_stream(fwspk); | ||
782 | mutex_unlock(&fwspk->mutex); | ||
783 | |||
784 | snd_card_free_when_closed(fwspk->card); | ||
785 | |||
786 | return 0; | ||
787 | } | ||
788 | |||
789 | static void fwspk_bus_reset(struct fw_unit *unit) | 733 | static void fwspk_bus_reset(struct fw_unit *unit) |
790 | { | 734 | { |
791 | struct fwspk *fwspk = dev_get_drvdata(&unit->device); | 735 | struct fwspk *fwspk = dev_get_drvdata(&unit->device); |
@@ -803,6 +747,40 @@ static void fwspk_bus_reset(struct fw_unit *unit) | |||
803 | amdtp_out_stream_update(&fwspk->stream); | 747 | amdtp_out_stream_update(&fwspk->stream); |
804 | } | 748 | } |
805 | 749 | ||
750 | static void fwspk_remove(struct fw_unit *unit) | ||
751 | { | ||
752 | struct fwspk *fwspk = dev_get_drvdata(&unit->device); | ||
753 | |||
754 | amdtp_out_stream_pcm_abort(&fwspk->stream); | ||
755 | snd_card_disconnect(fwspk->card); | ||
756 | |||
757 | mutex_lock(&fwspk->mutex); | ||
758 | fwspk_stop_stream(fwspk); | ||
759 | mutex_unlock(&fwspk->mutex); | ||
760 | |||
761 | snd_card_free_when_closed(fwspk->card); | ||
762 | } | ||
763 | |||
764 | static const struct device_info griffin_firewave = { | ||
765 | .driver_name = "FireWave", | ||
766 | .short_name = "FireWave", | ||
767 | .long_name = "Griffin FireWave Surround", | ||
768 | .pcm_constraints = firewave_constraints, | ||
769 | .mixer_channels = 6, | ||
770 | .mute_fb_id = 0x01, | ||
771 | .volume_fb_id = 0x02, | ||
772 | }; | ||
773 | |||
774 | static const struct device_info lacie_speakers = { | ||
775 | .driver_name = "FWSpeakers", | ||
776 | .short_name = "FireWire Speakers", | ||
777 | .long_name = "LaCie FireWire Speakers", | ||
778 | .pcm_constraints = lacie_speakers_constraints, | ||
779 | .mixer_channels = 1, | ||
780 | .mute_fb_id = 0x01, | ||
781 | .volume_fb_id = 0x01, | ||
782 | }; | ||
783 | |||
806 | static const struct ieee1394_device_id fwspk_id_table[] = { | 784 | static const struct ieee1394_device_id fwspk_id_table[] = { |
807 | { | 785 | { |
808 | .match_flags = IEEE1394_MATCH_VENDOR_ID | | 786 | .match_flags = IEEE1394_MATCH_VENDOR_ID | |
@@ -813,6 +791,7 @@ static const struct ieee1394_device_id fwspk_id_table[] = { | |||
813 | .model_id = 0x00f970, | 791 | .model_id = 0x00f970, |
814 | .specifier_id = SPECIFIER_1394TA, | 792 | .specifier_id = SPECIFIER_1394TA, |
815 | .version = VERSION_AVC, | 793 | .version = VERSION_AVC, |
794 | .driver_data = (kernel_ulong_t)&griffin_firewave, | ||
816 | }, | 795 | }, |
817 | { | 796 | { |
818 | .match_flags = IEEE1394_MATCH_VENDOR_ID | | 797 | .match_flags = IEEE1394_MATCH_VENDOR_ID | |
@@ -823,6 +802,7 @@ static const struct ieee1394_device_id fwspk_id_table[] = { | |||
823 | .model_id = 0x00f970, | 802 | .model_id = 0x00f970, |
824 | .specifier_id = SPECIFIER_1394TA, | 803 | .specifier_id = SPECIFIER_1394TA, |
825 | .version = VERSION_AVC, | 804 | .version = VERSION_AVC, |
805 | .driver_data = (kernel_ulong_t)&lacie_speakers, | ||
826 | }, | 806 | }, |
827 | { } | 807 | { } |
828 | }; | 808 | }; |
@@ -833,10 +813,10 @@ static struct fw_driver fwspk_driver = { | |||
833 | .owner = THIS_MODULE, | 813 | .owner = THIS_MODULE, |
834 | .name = KBUILD_MODNAME, | 814 | .name = KBUILD_MODNAME, |
835 | .bus = &fw_bus_type, | 815 | .bus = &fw_bus_type, |
836 | .probe = fwspk_probe, | ||
837 | .remove = fwspk_remove, | ||
838 | }, | 816 | }, |
817 | .probe = fwspk_probe, | ||
839 | .update = fwspk_bus_reset, | 818 | .update = fwspk_bus_reset, |
819 | .remove = fwspk_remove, | ||
840 | .id_table = fwspk_id_table, | 820 | .id_table = fwspk_id_table, |
841 | }; | 821 | }; |
842 | 822 | ||